Physics.Arcade#velocityFromAngle()

velocityFromAngle(angle, speed, point) → {Phaser.Point}

Given the angle (in degrees) and speed calculate the velocity and return it as a Point object, or set it to the given point object.
One way to use this is: velocityFromAngle(angle, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object.

Parameters
Name Type Argument Default Description
angle number

The angle in degrees calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative)

speed number <optional>
60

The speed it will move, in pixels per second sq.

point Phaser.Point | object <optional>

The Point object in which the x and y properties will be set to the calculated velocity.

Returns
  • A Point where point.x contains the velocity x value and point.y contains the velocity y value.
Source code: physics/arcade/World.js (Line 1772)
doc_phaser
2017-02-14 10:59:11
Comments
Leave a Comment

Please login to continue.