vectortoangle

calvin9403calvin9403 Member Posts: 3,186
edited November -1 in Working with GS (Mac)
Hey everyone

I want to make so when a touch the scene the rocket will move there

so I create attribute move? bool false

IN BACKGROUND

when background touch is press, change attribute move? to true

IN ROCKET

when attribute move? is true, interpolate the rocket' X and Y pos to touch X and Y

that is easy enough

but now I want the rocket to face the point were is flying

so I do

IN ROCKET

when attribute move? is true, constrain attribute self.rotate to

vectorToAngle( self.Position.X - game.Touches.Touch 1.X , self.Position.Y - game.Touches.Touch 1.Y )

but something seems wrong because it will sometimes rotate to 30 degrees more right

Thanks

Calvin

_______________________________________________
http://www.thatgameforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/wiki/
«1

Comments

Sign In or Register to comment.