make a object move in a figure 8 motion?

patm1982patm1982 Member Posts: 50
Hello,
in my game the character has a figure 8 gyration at all times. I've been just using a animation of a figure 8 I created in flash, but i'm sure thats really killing performance.

an alternative would be to use a series of interpolations, but I have a feeling those would hurt performance too.
if anybody knows how to do the math for a figure 8 it would be vary appreciated. thanks

Comments

  • old_kipperold_kipper Member Posts: 1,420
    HI Patm, I wondered about your question so have made a demo that you can download from the new menu when you launch GS. Search on 'figure' and I hope you will find it. It doesn't seem to work on my GS profile page, but does out of GS.

    It uses 2 change attributes (not in rules so they only act once at the launch) to put the start position into a pair of self integer attributes (x and y) and the does 60 pixel block offsets every second which also increment a third self integer attribute for each position and to tell the actor to go to the next point in the cycle. It starts at 0 in this, and when it hits 7 it returns to 0 (the start point). I used interpolate on the movement with the ease in and out functions to get the actor to follow a curved path.

    If you need to change the size of the path or speed, you will just have to adjust the timings in the interpolates., and /or the size of the offsets.

    I hope this does it for you, and I am sure with 'REAL' maths you could pull something more trick but this does seem to work. If you want to lay the 8 on it's side it will be a case of thinking out the changes to what I've done...

    Cheers Kipper

    p.s. I note your worry about using interpolates but seems pretty easy on the processor with 60 fps on a 2gen itouch.
  • patm1982patm1982 Member Posts: 50
    Hi Kipper,

    I found the project, but when I load its completely empty. no actors in the library. Is it possible it didn't get saved or uploaded completely?

    thanks for the help
    -pat
  • patm1982patm1982 Member Posts: 50
    I ended up just using the circle demo in the 'how to' section and making it a half a circle arc back and forth, does the job just fine.
Sign In or Register to comment.