Main Page
News
History
Limitations
Graphics
Music
Levels
Gameplay
Now Browsing
Links
Download

Circle

        CIRCLE                RadiusX, RadiusY, AngleXStart, AngleYStart, SpeedX, SpeedY, Count

Args:

  • RadiusX: elliptic horizontal distance from the center.
  • RadiusY: elliptic vertical distance from the center.
  • AngleXStart: start angle X 256 based.
  • AngleYStart: start angle Y 256 based.
  • SpeedX: speed step on X per frame.
  • SpeedY: speed step on Y per frame.
  • Count: command active frame counting.
  • Cycles: variable/usually expensive

    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.
    However while circles are flexible to use and produce the nicest paths, they are also by far the most complex command to master and due to the expense they must be used with care or depending what else is going on at that point in the level, could slow the game down.

    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:
                                    PFor    50
                                            Move    -2,0
                                    PNext
                                   
    Circle        50, 50, 0, 0, 2, 2, 128
                                    PFor    50
                                            Move    -2,0
                                    PNext
                                    KillSprite

    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.

    Now, we want to reverse the direction. This is again a simple change, and we do this by changing the 2, 2 to a -2, -2:

                                    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)

    So to make it do only ½ a circle, all we need to do is half the time spent inside the circle command like so:

                                    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:
                                    PFor    50
                                            Move    -2,0
                                    PNext
                                   
    Circle        50, 50, 192, 192, -2, -2, 64
                                    PFor    50
                                            Move    -2,0
                                    PNext
                                    KillSprite

    See also:
    MasterPath
    RadiusX
    Radiusy
    AngleXStart
    AngleYStart
    SpeedX
    SpeedY
    Count

    Main Table