Moving Objects in Gamesalad

jblb2424jblb2424 Member Posts: 65
edited March 2012 in Working with GS (Mac)
Hey all,
Quick question, lets say i have an in game joystick. And when you pull the in game joystick at a specific angle, a specific object in the scene will move at that angle. Is this possible? If so how can someone tell me how i can accomplish this? Thanks! :D

Best Answer

  • JohnPapiomitisJohnPapiomitis Posts: 6,256
    edited March 2012 Accepted Answer
    If your using the cross platoform control template that gamesalad provides,

    Theres a attribute called stick 2 active, which is true when your moving the joystick and false when its not, and theres an attribue called angle2 which is the angle of the joystick.

    So you could do something like this.

    When attribute stick2active=true
    -change velocity(or move) and have the angle2 attribute as the direction

    Edit:

    To add onto this, i saw the other question you posted about the art and animation. All you would do is need the one animation of the ball rolling. You dont need one for every angle, because you can just constrain the balls rotation to

    vectorToAngle(self.motion.linear.velocity.X,self.motion.linear.velocity.Y)

    then it will always be facing the way its moving.

    To go even further, you would want your rolling animation in a rule when stick2active=true
    so it only animates when its moving.

    cheers
Sign In or Register to comment.