How do I set sprite angle to angle of physics motion

0 favourites
  • 5 posts
From the Asset Store
Complete the collection by purchasing Motion Universe Pt. 2
  • Hi everyone,

    probably an easy one, but can someone tell me how to set the angle of a sprite to the angle of its motion? By that I mean so the sprite is always 'facing' the direction it is traveling in (like a rocket).

    Thanks!

  • set angle of sprite to

    angle(0,0,self.Physics.VelocityX,self.Physics.VelocityY)

  • set angle of sprite to

    angle(0,0,self.Physics.VelocityX,self.Physics.VelocityY)

    That's exactly what I was looking for, thank you!

    Just one question, I understand the self.Physics.VelocityX,self.Physics.VelocityY, but why put 0,0 in there first? And how did you work out you needed to do that?

    Thanks again for your help!

  • by standing on the shoulders of giants

    angle(x1, y1, x2, y2) Calculate angle between two points

    self.physics.velocityx and self.physics.velocityy is the velocity (speed) in pixels / second so for example if velocityx is 4 and velocityy is 3 then angle(0,0,4,3) is going to give you the angle from 0,0 to 4,3 (30 degrees ?)

    Hope this helps ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • by standing on the shoulders of giants

    angle(x1, y1, x2, y2) Calculate angle between two points

    self.physics.velocityx and self.physics.velocityy is the velocity (speed) in pixels / second so for example if velocityx is 4 and velocityy is 3 then angle(0,0,4,3) is going to give you the angle from 0,0 to 4,3 (30 degrees ?)

    Hope this helps ?

    Thank you very much for taking the time to explain! Yeah that helped a lot, much appreciated .

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)