Skip to content

Commit 6933b41

Browse files
committed
Arcade.Body's speed property was only set when the body moved, it now updates regardless (thanks @mark-henry phaserjs#2417)
1 parent aee0212 commit 6933b41

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
356356
* BitmapData.copy, and by extension draw, drawFull, drawGroup, etc, would incorrectly handle drawing a tinted Sprite if it was using a frame from a texture atlas (thanks @PhaserDebugger #2405)
357357
* Text that used fonts which had numbers in their names wouldn't be correctly rendered unless you explicitly set the font property after creation. You can now pass font names with numbers in them as the font style object correctly (thanks @And-0 #2390)
358358
* Tween.update wouldn't dispatch an `onLoop` signal for Tweens with just one child, such as those created via Tween.to with -1 as the repeat value (thanks @ForgeableSum #2407)
359+
* Arcade.Body's speed property was only set when the body moved, it now updates regardless (thanks @mark-henry #2417)
359360

360361
### Pixi Updates
361362

src/physics/arcade/Body.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,11 @@ Phaser.Physics.Arcade.Body.prototype = {
467467

468468
if (this.position.x !== this.prev.x || this.position.y !== this.prev.y)
469469
{
470-
this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
471470
this.angle = Math.atan2(this.velocity.y, this.velocity.x);
472471
}
473472

473+
this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
474+
474475
// Now the State update will throw collision checks at the Body
475476
// And finally we'll integrate the new position back to the Sprite in postUpdate
476477

0 commit comments

Comments
 (0)