Jump to content

How do you angle a sprite towards another sprite?


AustinKellar
 Share

Recommended Posts

Phaser may have a built-in method for this somewhere, but personally I would just use a bit of maths.  Not tested but I think this should work:

objectSprite.rotation = Math.atan2(targetSprite.y - objectSprite.y, targetSprite.x - objectSprtie.x);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...