Jump to content

Using Phaser.Math.angleBetween


Recommended Posts

So I'm trying to change the angle of a sprite based on bitmap collision detection:

var angle = Phaser.Math.angleBetween(Math.floor(mech.body.center.x), Math.floor(mech.body.bottom), Math.floor(mech.body.prev.x + (mech.body.width / 2)), Math.floor(mech.body.prev.y + mech.body.height));

Problem it produces a 90 degree angle by default and is very random, any ideas what I may be doing wrong here?

Edit: forgot bottom is a y variable, but still gives me a weird angle.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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