Jump to content

game.physics.arcade.moveToPointer. How can I get moveFromPointer functionality


CalmNearEnd
 Share

Recommended Posts

Hi,

 

I'm using game.physics.arcade.moveToPointer to make a bullet fly where I click:

 

game.physics.arcade.moveToPointer(bullet, bulletSpeed);

 

 

But I want my character to recoil and fly backwards when he shoots.

I'm trying it like so:

 

angleToPointer = game.physics.arcade.angleBetween(player, game.input);
 
game.physics.arcade.velocityFromAngle(angleToPointer -180, 300, player.body.velocity);
 
But it's not working. Any help?
 
Thanks
 
 

 

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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