Jump to content

Can't set x/y of sprites, only velocity


Stephen304
 Share

Recommended Posts

So I have a sprite for the player basically the same way as tutorials:

    player = game.add.sprite(32, game.world.height - 150, 'man');    player.body.bounce.y = 0;    player.body.gravity.y = 6;    player.body.collideWorldBounds = true;
And I know I can set velocity with
player.body.velocity.x = 150;

But how can I teleport the player? I have tried:

player.body.x = 50;

But it seems to get reverted back instantly to the original coordinate.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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