Anyone make an object rotate and move backwards in a circle?

jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
edited November -1 in Working with GS (Mac)
I'm working on new game, and I'm having trouble making something work and look good at the same time. I've got a plane flying across the top of my screen, when it get's close to the edge, I want it to do a loop and head back in the other direction. Basically, I want it to fly in a big wide circle. Something like this but with rounded edges: <====>

I've tried implementing something out of the joystick controls (the one stick to move and rotate), but it's just not working right. Anyone work something out like this before?

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    as always, 5 minutes after I post I figured out a solution. Probably not the best way of doing things, but it worked for me. I'll post details in a few minutes
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    ok, here's what I did:

    2 attributes: turnLeft & turnRight

    2 Hot Zones, left and right. Each had a rule that said:
    when overlap or collide with plane, set attribute turnLeft to 1
    after 5 seconds, set attribute turnRight to 0

    On my plane, I have a timer adjusting velocity every .1 seconds
    every .1 seconds
    change velocity to 150 at angle 0 relative to actor

    and the rules to rotate
    when turnLeft is 1, rotate to 180 relative to scene at speed 150 with run to completion checked

    I did the same thing for right, now my plane flies in a nice circle, or at least the green block that represents my plane does :)
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I uploaded a demo if anyone is interested

    http://gamesalad.com/game/play/46465
  • adadoadado Member Posts: 219
    Pretty slick and no trig!
Sign In or Register to comment.