Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

moveToPointer/angleToPointer for a sprite?


CaptKiwi
 Share

Recommended Posts

Hi Guys,

 

There are the following commands : 

 

bullet.rotation = game.physics.moveToPointer(bullet, 300)

 

sprite.rotation = game.physics.angleToPointer(sprite);

 

I would rather have the bullet move to a particular sprite on the screen or angle to it, rather than going to the mouse pointer.

 

Is there a similar command we can use like "move to sprite" or "angle to sprite" rather than moving to the pointer?

 

Cheers!

Link to comment
Share on other sites

In dev branch: 

game.physics.moveToObject(displayObject, destination, speed, maxTime);

Also you may find useful: moveToXY, accelerateToObject and accelerateToXY.

Thank you rich.

 

I was able to use "game.physics.moveToObject" and "angleBetween" to get the desired bullet movement effect :-)

Link to comment
Share on other sites

  • 2 months later...
 Share

  • Recently Browsing   0 members

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