yegorf1 Posted May 8, 2014 Share Posted May 8, 2014 Holla, amigos!How to slow moving of bodies in P2 physics? I need to substrat 1 pts from body speed per second. Link to comment Share on other sites More sharing options...
valueerror Posted May 8, 2014 Share Posted May 8, 2014 you could move it like you would move every object in p2 just with a very very low value? in the update() function:player.body.moveRight(10);this movement is hardly visible.. if you go even lower this is maybe what you want..otherwise you could do something like this to be very precise.. in the create() function:game.time.events.loop(Phaser.Timer.SECOND * 1, moveBody, this);function moveBody(){ whatever.body.x += 1;} Link to comment Share on other sites More sharing options...
yegorf1 Posted May 12, 2014 Author Share Posted May 12, 2014 you could move it like you would move every object in p2 just with a very very low value? in the update() function:player.body.moveRight(10);this movement is hardly visible.. if you go even lower this is maybe what you want..otherwise you could do something like this to be very precise.. in the create() function:game.time.events.loop(Phaser.Timer.SECOND * 1, moveBody, this);function moveBody(){ whatever.body.x += 1;}No, I setting velocity to move. Link to comment Share on other sites More sharing options...
yegorf1 Posted May 12, 2014 Author Share Posted May 12, 2014 After looking on Phaser source, I found solution:whatever.body.data.velocity[0] *= 0.99;whatever.body.data.velocity[1] *= 0.99; Link to comment Share on other sites More sharing options...
Recommended Posts