Jump to content

Sprite Accelerate to Sprite


Boxtufty
 Share

Recommended Posts

I did this, see if it solves your problem:

function create() {	sprite1 = game.add.sprite(200, 200, 'sprite1');	sprite2 = game.add.sprite(100, 100, 'sprite2');	game.physics.enable(sprite1, Phaser.Physics.ARCADE);}function update() {	game.physics.arcade.accelerateToObject(sprite1, sprite2);}

Here there is the documentation, there is more ways to accelerate a sprite, such as accelerateToXY.

 

http://docs.phaser.io/Phaser.Physics.Arcade.html#accelerateToObject

 

(:

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...