velocity angle
Problem it solves
You want to rotate a sprite's image to face the direction it's actually moving, but you only have its velocity.
What this block does
Returns the angle of a sprite's current movement, in radians.
The block
Block ID: spriteutilheading
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| sprite | Sprite | mySprite | The sprite to check |
Returns
number — The angle of movement in radians.
Example
let mySprite = sprites.create(img`.`, SpriteKind.Player) let myEnemy = sprites.create(img`.`, SpriteKind.Enemy) let direction = spriteutils.heading(mySprite) console.log(direction)
Add the extension
Add github:jwunderl/arcade-sprite-util to your project, or open: Import arcade-sprite-util.