CIRCLE RadiusX, RadiusY, AngleXStart, AngleYStart, SpeedX, SpeedY, Count Args: If we wanted to make a more complex path – like a circle, we could either use many small Move commands, or use the Circle command. It should be noted, that the Circle command is very slow by comparison, but you can create some amazing paths using it. The basic rule is that to get a smooth start to the path, you must start it at the correct angle so that it carries on from there. Making all the numbers different, allows you to produce some amazing paths by adjusting these numbers to fit. Example: ring-a-ring-o'roses. Let’s create a very simple path using the circle command. First, let’s alter our DemoPath1 to do something a bit more interesting:
DemoPath1: So, if you enter this, what you’ll discover is that our sprites now all come in 100 pixels, and then execute a full circle, before going back off screen again. Now, this would have taken us many, many Move commands, and been fairly complex to actually work out, but here it is done in one simple instruction – and smoothly too! But, it doesn’t quite look as nice as we’d like. What if we decided to change the shape to produce a side on U shape? How can we do that? Simple, we just alter the circle command a little. First we’ll change the start angle from 0 to -64 (or 192 if you like) which now means the circle starts at the top like this: Circle 50, 50, -64, -64, 2, 2, 128 So, instead of the circle starting halfway around,
it now starts at the top. This is because our angles are from 0 to
255 (not 0 to 359). So 180 degrees is in fact 128 to us. 90 degrees
would be 64 and so on. (and 360 = 256). So -64 = 192, or 270 degrees
– which is at the top. Circle 50, 50, -64, -64, -2, -2, 128 So far, so good. But if you run this, you’ll see
it still goes full circle. Now why does it do 360 degrees (or 256 to
us) when it’s only set to 128. This is simply because it’s moving 2
degrees (now -2) each frame, and 2*128=256 (or full circle) Circle 50, 50, -64, -64, -2, -2, 64 Now what you’re left with is a smooth complex path, and taking up very little script memory! The final path looks like this:
DemoPath1: |
See also: |