javascriptphaser-frameworkphaserjs

How to access current velocity of a sprite in Phaser JS


Is there a way to get the current velocity of a sprite in Phaser or another obvious way of finding when the player is still?


Solution

  • Try something like the example below. More info about Phasers velocity here

    // X velocity 
    sprite.body.velocity.x
    // Y velocity 
    sprite.body.velocity.y