Search the Community
Showing results for tags 'ps'.
-
I'm new to Phaser, been playing with it the past few days. I noticed odd behavior when setting velocity in P2. This would not work as expected: bullet.body.velocity.x = this.sprite.body.velocity.x;bullet.body.velocity.y = this.sprite.body.velocity.y;After searching through the source I noticed that P2 converts the values from px to "meters" when setting the velocity, however it does not convert back to px when retrieving them. This happens in InversePointProxy for velocity, but properties using PointProxy would have the same issue as well. I was able to fix it temporarily with this code: bullet.body.velocity.x = this.sprite.body.velocity.x * -20;bullet.body.velocity.y = this.sprite.body.velocity.y * -20;I tried to update the phaser source files to do the conversion both ways so I wouldn't need to do this, but this seemed to cause other issues when running my game. I updated both InversePointProxy and PointProxy. Is this behavior by design? Here is an example of the change I made, Added this.world.mpxi() to the get.: get: function () { return this.world.mpxi(this.destination[0]); }, set: function (value) { this.destination[0] = this.world.pxmi(value); }