Assuming you turned on physics and already assigned each of the coordinates on your way to the regions of your scene.
Straight line movement
I would suggest Physics.Arcade.movetoXY () .
The function returns the angle to the target location if you need to rotate your sprite.
sprite.rotation = game.physics.arcade.moveToXY(
sprite,
target.x,
target.y,
300
500
);
, - update():
player.body.velocity.x = 0;
player.body.velocity.y = 0;
, . xy . , , .
, , .
, "" , , .
, , , Phaser.Timer ( Pokemen, ) update() ), , , , Phaser.Arcade.Physics(moveToXY, accelerateToXy ..) .
- A *, , , , .
rot.js - , A * path finder.
- Phaser ( ), .
, .
, , sprite.body.setBounds(), Math.snapTo(), .
update() .
if (cursors.left.isDown) {
game.physics.arcade.moveToXY(
sprite,
sprite.body.x - 70,
Phaser.Math.snapTo(sprite.body.y, 70),
250
) };