Skip to content

Commit 3b73c17

Browse files
committed
ArcadePhysics.Body.phase is checked in postUpdate to prevent it from being called multiple times in a single frame.
1 parent 1164bf8 commit 3b73c17

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Happy coding everyone! See you on the forums.
4545

4646
We have a new [Getting Started Guide](http://phaser.io/getting-started-js.php) which covers all you need to begin developing games with Phaser. From setting up a web server to picking an IDE. If you're new to HTML5 game development, or are coming from another language like AS3, then we recommend starting there.
4747

48-
There is a comprehensive [How to Learn Phaser](http://gamedevelopment.tutsplus.com/articles/how-to-learn-the-phaser-html5-game-engine--gamedev-13643) guide on the GameDevTuts+ site which is a great place to learn where to find tutorials, examples and support.
48+
We wrote a comprehensive [How to Learn Phaser](http://gamedevelopment.tutsplus.com/articles/how-to-learn-the-phaser-html5-game-engine--gamedev-13643) guide for GameDevTuts+ which covers finding tutorials, examples and support.
4949

50-
There is also an [un-official Getting Started Guide](http://www.antonoffplus.com/coding-an-html5-game-for-30-minutes-or-an-introduction-to-the-phaser-framework).
50+
Finally the growing list of [community authored Phaser Tutorials](http://www.lessmilk.com/phaser-tutorial/) is growing fast!
5151

5252
![Phaser Logo](http://www.photonstorm.com/wp-content/uploads/2013/09/phaser_10_release.jpg)
5353

@@ -64,6 +64,7 @@ Version 2.0.4 - "Mos Shirare" - in development
6464
* The Input.reset `hard` reset parameter is now passed down to the Keyboard and Key reset methods.
6565
* AnimationManager.destroy now iterates through child animations calling destroy on all of them, avoiding a memory leak (thanks stauzs)
6666
* AnimationManager.play will now call Animation.stop on the current animation before switching to the new one (thanks @nihakue, #713)
67+
* ArcadePhysics.Body.phase is checked in postUpdate to prevent it from being called multiple times in a single frame.
6768

6869

6970
### New Features

src/physics/arcade/Body.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Phaser.Physics.Arcade.Body = function (sprite) {
287287
this.tilePadding = new Phaser.Point();
288288

289289
/**
290-
* @property {number} phaser - Is this Body in a preUpdate or postUpdate state?
290+
* @property {number} phaser - Is this Body in a preUpdate (1) or postUpdate (2) state?
291291
*/
292292
this.phase = 0;
293293

@@ -434,6 +434,12 @@ Phaser.Physics.Arcade.Body.prototype = {
434434
*/
435435
postUpdate: function () {
436436

437+
// Only allow postUpdate to be called once per frame
438+
if (this.phase === 2)
439+
{
440+
return;
441+
}
442+
437443
this.phase = 2;
438444

439445
if (this.deltaX() < 0)

0 commit comments

Comments
 (0)