How to rotate a player to face left and right
Hi
Noob question
I am building a game based on the basic shooter. I would like the ship, actor, to face the direction it is going. How is the done? I've been searching the forum tried some ANgletoVector but this didn't work
Noob question
I am building a game based on the basic shooter. I would like the ship, actor, to face the direction it is going. How is the done? I've been searching the forum tried some ANgletoVector but this didn't work
Comments
change attribute self.rotation to:
vectorToAngle(moveToX - self.position.X, moveToY - self.position.Y)
Where moveToX and moveToY are the X and Y coordinates you are moving toward. This will rotate your actor to face those x/y coordinates. This calculation assumes the image on your actor faces right (angle 0).
the control is fine I need the image to change when "left" or "Right" are pressed