Best way to move player sprite

Hi there!
I’m using a physics arcade.
I’m having some doubt about how to move the player.
I already tried of these 3 methods on the update function:

        player.body.y += 1;
        player.y += 1;
        player.setVelocity(0, 48);

With the first two ones I notice that when the sprite touches a screen edge, it still moves a little bit out of it.
But with the setVelocity, the sprite doesn’t do that.
How should I use and what is the difference between them?

Hi,
Try player.body.setVelocity(0, 48), if you modify the body.y directly the collisions wouldn’t work

1 Like

Hi!
Thanks for the info! Didn’t know the collision thing.
Yes, I have changed:

this.player.setVelocity

to

this.player.body.setVelocity.

Thank you!