Phaser API Documentation

accelerateTo(gameObject, x, y, [speed], [xSpeedMax], [ySpeedMax])


Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given rate (in pixels per second squared)

You must give a maximum speed value, beyond which the game object won't go any faster.

Note: The game object does not continuously track the target. If the target changes location during transit the game object will not modify its course. Note: The game object doesn't stop moving once it reaches the destination coordinates.


name type arguments Default description
gameObject Phaser.GameObjects.GameObject

Any Game Object with an Arcade Physics body.

x number

The x coordinate to accelerate towards.

y number

The y coordinate to accelerate towards.

speed number <optional> 60

The acceleration (change in speed) in pixels per second squared.

xSpeedMax number <optional> 500

The maximum x velocity the game object can reach.

ySpeedMax number <optional> 500

The maximum y velocity the game object can reach.


The angle (in radians) that the object should be visually set to in order to match its new velocity.

  • number
Since: 3.0.0