How to get an arc, half turn, 3/4 turn for an enemy in a vertical shooter

jasdipjasdip Member, PRO Posts: 7
edited August 2012 in Working with GS (Mac)
Hi,

I am working on a vertical shooter and have various actors that fly from the top of the screen towards varying x,y coords on the screen, the enemy ships then rotate and fly to another x,y coord that I specify. I have this working through the use of a couple of move to and rotate position behaviours, however, even though I am pleased to get this working I would like to get more of an arc working when the ship turns to its new x,y coord. I've been looking at various sin & cos expressions and math formulas placed on the forums but i am just not getting it. Any advice on how to achieve an arc, half turn, 3/4 turn would be appreciated.

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited August 2012
    The kinds of arcs you are looking for happen naturally as the actors rotate to point at the new x,y coords while moving 'forward'.

    Experiment with something like this:

    When mousedown
    -- Rotate To Position
    ---- Position ^: game.Mouse.Position.X
    ---- Position>: game.Mouse.Position.Y
    ---- Offset Angle: 0
    ---- Speed: 180
    ---- Relative to: scene
    ---- Run to completion:√
    ---- Stops on destination:√
    -- Timer, Every .05 seconds, Run to Completion:√
    ---- Change Velocity
    ------ Direction: 0
    ------ Relative to: actor
    ------ Speed: 90

  • LumpAppsLumpApps Member Posts: 2,881
    Another method that could work but can give you collision problems if you need that is interpolate to an x and y value. When you do ease out or in on just one of them you get sort of arc.
  • jasdipjasdip Member, PRO Posts: 7
    Thanks for the info to both RThurman and LudwigHeijden
Sign In or Register to comment.