Skip to content

Commit 622957c

Browse files
committed
Timer objects incorrectly set the first tick value on events if you added the events prior to starting them.
1 parent 26a89f0 commit 622957c

10 files changed

Lines changed: 122 additions & 51 deletions

File tree

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Phaser 2.0.1
55

66
Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) internally for fast 2D Canvas and WebGL rendering.
77

8-
Version: 2.0.1 "Lyrelle" - Released: 21st March 2014
8+
Version: 2.0.1 "Lyrelle" - Released: 24th March 2014
99

1010
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
1111

@@ -63,7 +63,7 @@ There is also an [un-official Getting Started Guide](http://www.antonoffplus.com
6363
Change Log
6464
----------
6565

66-
Version 2.0.1 - "Lyrelle" - 21st March 2014
66+
Version 2.0.1 - "Lyrelle" - 24th March 2014
6767

6868
Bug Fixes
6969

@@ -97,6 +97,7 @@ Bug Fixes
9797
* BitmapDatas when used as Game Object textures in WebGL now update themselves properly.
9898
* Timer.ms now correctly reports the ms time even if the Timer has been paused (thanks Nambew, fix #624)
9999
* If you added a Tileset to an empty map it would eventually throw an out of memory error.
100+
* Timer objects incorrectly set the first tick value on events if you added the events prior to starting them.
100101

101102

102103
Updated
@@ -143,9 +144,9 @@ New Features
143144
* There is a brand new PhysicsEditor export script specifically for Phaser (in the resources folder), and new p2 polygon parsing functions thanks to georgiee.
144145

145146

146-
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available. In the guide we detail the API breaking changes and approach to our new physics system. For a list of all the other new features, updates and bug fixes present in 2.0 please see the Change Log.
147+
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available for those converting from Phaser 1.x to 2.x. In the guide we detail the API breaking changes and approach to our new physics system.
147148

148-
The Change Log for all previous versions is at https://github.com/photonstorm/phaser/blob/master/changelog.md
149+
The full Change Log is at https://github.com/photonstorm/phaser/blob/master/changelog.md
149150

150151

151152
How to Build

build/custom/phaser-no-libs.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://www.phaser.io
99
*
10-
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 01:37:07
10+
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 02:25:16
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -27174,16 +27174,13 @@ Phaser.Timer.prototype = {
2717427174

2717527175
var tick = delay;
2717627176

27177-
if (this.running)
27177+
if (this._now === 0)
2717827178
{
27179-
if (this._now === 0)
27180-
{
27181-
tick += this.game.time.now;
27182-
}
27183-
else
27184-
{
27185-
tick += this._now;
27186-
}
27179+
tick += this.game.time.now;
27180+
}
27181+
else
27182+
{
27183+
tick += this._now;
2718727184
}
2718827185

2718927186
var event = new Phaser.TimerEvent(this, delay, tick, repeatCount, loop, callback, callbackContext, args);

build/custom/phaser-no-libs.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/phaser-no-physics.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://www.phaser.io
99
*
10-
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 01:37:07
10+
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 02:25:16
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -9604,7 +9604,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
96049604
*
96059605
* Phaser - http://www.phaser.io
96069606
*
9607-
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 01:37:07
9607+
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 02:25:16
96089608
*
96099609
* By Richard Davey http://www.photonstorm.com @photonstorm
96109610
*
@@ -36771,16 +36771,13 @@ Phaser.Timer.prototype = {
3677136771

3677236772
var tick = delay;
3677336773

36774-
if (this.running)
36774+
if (this._now === 0)
3677536775
{
36776-
if (this._now === 0)
36777-
{
36778-
tick += this.game.time.now;
36779-
}
36780-
else
36781-
{
36782-
tick += this._now;
36783-
}
36776+
tick += this.game.time.now;
36777+
}
36778+
else
36779+
{
36780+
tick += this._now;
3678436781
}
3678536782

3678636783
var event = new Phaser.TimerEvent(this, delay, tick, repeatCount, loop, callback, callbackContext, args);

build/custom/phaser-no-physics.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://www.phaser.io
99
*
10-
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 01:37:07
10+
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 02:25:16
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -9604,7 +9604,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
96049604
*
96059605
* Phaser - http://www.phaser.io
96069606
*
9607-
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 01:37:07
9607+
* v2.0.1 "Lyrelle" - Built: Mon Mar 24 2014 02:25:16
96089608
*
96099609
* By Richard Davey http://www.photonstorm.com @photonstorm
96109610
*
@@ -36771,16 +36771,13 @@ Phaser.Timer.prototype = {
3677136771

3677236772
var tick = delay;
3677336773

36774-
if (this.running)
36774+
if (this._now === 0)
3677536775
{
36776-
if (this._now === 0)
36777-
{
36778-
tick += this.game.time.now;
36779-
}
36780-
else
36781-
{
36782-
tick += this._now;
36783-
}
36776+
tick += this.game.time.now;
36777+
}
36778+
else
36779+
{
36780+
tick += this._now;
3678436781
}
3678536782

3678636783
var event = new Phaser.TimerEvent(this, delay, tick, repeatCount, loop, callback, callbackContext, args);

build/phaser.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

changelog.md

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,93 @@
11
Change Log
22
==========
33

4+
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available for those converting from Phaser 1.x to 2.x. In the guide we detail the API breaking changes and approach to our new physics system.
5+
6+
7+
Version 2.0.1 - "Lyrelle" - 24th March 2014
8+
-------------------------------------------
9+
10+
Bug Fixes
11+
12+
* The Static, Kinematic and Dynamic consts that P2.Body uses were incorrect (fixes #563)
13+
* Sprite.destroy would fail if it had an Arcade Physics body, now added.
14+
* Group.getAt comparison updated (fixes #578)
15+
* Fixed the IE11 version check (fixes #579)
16+
* Ninja world collision to check right and bottom bounds (thanks dreadhorse, fix #571)
17+
* Group enableBody parameter was incorrectly assigned to the debug var (thanks BurnedToast, fix #565)
18+
* Fixed Tile callback check in Arcade Physics (fix #562)
19+
* Removed the examples build script from the Gruntfile (fix #592)
20+
* The P2 World wouldn't clear down fully on a State change, now properly clears out contacts, resets the bitmask, etc.
21+
* Button.onInputUpHandler wouldn't set an upFrame for a frame ID of zero, made the check more strict.
22+
* Fixed the Loader.preloadSprite crop effect on WebGL.
23+
* Fixed Grunt script that stopped the P2 constraint classes from building properly.
24+
* World.destroy incorrectly clashed with the Group.destroy method it over-rode, renamed to World.shutdown and updated StateManager accordingly.
25+
* World.shutdown now removes all children iteratively, calling destroy on each one, ultimately performing a soft reset of the World.
26+
* Objects with a scale.x or y of 0 are no longer considered valid for input (fix #602)
27+
* InputHandler will set the browser pointer back to default if destroyed while over (fix #602)
28+
* ArcadePhysics.separate doesn't pass over to seperateX/Y if overlapOnly is true (fix #604)
29+
* ArcadePhysics.collideSpriteVsSprite checks if both objects have bodies before processing.
30+
* Debug.spriteBounds will now take the position of the camera into consideration when rendering the bounds (fix #603)
31+
* InputHandler.dragFromCenter will now work regardless of the anchor point of the Sprite (fix #600)
32+
* Emitter.friction property removed and replaced with Emitter.particleDrag, which is now correctly applied.
33+
* ArcadePhysics.Body.reset incorrectly set the Body.rotation to Sprite.rotation instead of angle.
34+
* Emitter.emitParticle resets the rotation on the particle to zero before emitting it.
35+
* If no seed was given in the Game config object, the RandomDataGenerator wouldn't be started (thank tylerjhutchison fix #619)
36+
* p2 revolute pivots were wrongly signed (thanks georgiee, fix #621)
37+
* P2.Body.loadPolygon no longer modifies the Cache array (fix #613)
38+
* The volume given in Sound.play now over-rides that set in Sound.addMarker if specified (fix #623)
39+
* BitmapDatas when used as Game Object textures in WebGL now update themselves properly.
40+
* Timer.ms now correctly reports the ms time even if the Timer has been paused (thanks Nambew, fix #624)
41+
* If you added a Tileset to an empty map it would eventually throw an out of memory error.
42+
43+
44+
Updated
45+
46+
* Updated Device.isConsoleOpen as it no longer works in Chrome. Revised code and documentation accordingly (fix #593)
47+
* Removed State.destroy empty method and replaced with State.shutdown, as that is what the StateManager expects (fix #586)
48+
* P2.removeBody will check if the body is part of the world before removing, this avoids a TypeError from the p2 layer.
49+
* Tilemap.createFromObjects has a new parameter: adjustY, which is true by default. Because Tiled uses a bottom-left coordinate system Phaser used to set the Sprite anchor to 0,1 to compensate. If adjustY is true it now reduces the y value by the object height instead.
50+
* Swapped the order of the _pollGamepads gamepads check, to stop the Chrome 'webkitGamepads is deprecated' error in the console.
51+
* Lots of TypeScript definitions updates (thanks as always to clark for these)
52+
* Removed Device.patchAndroidClearRectBug as it's no longer used internally.
53+
* Math.wrapAngle now supports radians (thanks Cryszon, #597)
54+
* Group.replace will now return the old child, the one that was replaced in the Group.
55+
* Group.destroy has a new parameter: `soft`. A soft destruction won't remove the Group from its parent or null game references. Default is `false`.
56+
* InputHandler.validForInput is a new method that checks if the handler and its owner should be considered for Pointer input handling or not.
57+
* ArcadePhysics.Body now checks the ArcadePhysics.World bounds, not the game bounds.
58+
* ArcadePhysics.Body has reverted to the 1.1.3 method of preUpdate, so you can now position sprites with x/y, drag them, etc, regardless of the Body.moves flag (issue #606)
59+
* ArcadePhysics.World now has setBounds and setBoundsToWorld methods, which are called automatically on world resizing.
60+
* ArcadePhysics.Body no longer sets the offset to match the anchor.
61+
* The StateManager is now responsible for clearing down input, timers, tweens, physics, camera and the World display list.
62+
* Removed the use of Int16Array from all Game Objects, swapped for standard Array. Phaser now runs on Android 2.x and IE9 again (fix #590)
63+
* When creating a Sprite (via Group.create or directly) with exists = false and a P2 body, the body is not added to the world.
64+
* Every Input class now checks to see if it has already been started. If so it doesn't add the listeners again unless they have been nulled.
65+
* Lots of fixes to the TypeScript definitions file (thanks as always to clark-stevenson for his tireless work on these)
66+
* Emitters now bring the particle they are about to emit to the top of the Group before doing so. Avoids particles hidden behind others.
67+
* ArcadePhysics.Body.setSize corrected to take the parameters as positive, not negative values.
68+
* ArcadePhysics.World.seperate will now check gravity totals to determine separation order. You can set World.forceX to true to always separate on X first and skip this check.
69+
* TileSprites now emit outOfBounds and enterBounds events accordingly.
70+
* You can now create multiple blank layers in a Tilemap.
71+
72+
73+
New Features
74+
75+
* Device.getUserMedia boolean added, useful if you need access to the webcam or microphone.
76+
* Math.removeRandom allows you to remove (and return) a random object from an array.
77+
* ArcadePhysics.World now has a checkCollision object which can be used to toggle collision against the 4 walls of its bounds.
78+
* Sprite.events.onEnterBounds added. This is dispatched if the Sprite leaves the bounds but then returns. The opposite of onOutOfBounds.
79+
* Timer.removeAll will remove and clear down all events, but keeps the Timer running.
80+
* Group.setAllChildren recursively checks if its children are Groups, and if so recursively applies the value to their children as well (feature #589)
81+
* Time.deltaCap lets you set a cap for the delta timer. It defaults to zero (which is disabled). If you use ArcadePhysics it gets set to 0.2, but you can modify as needed.
82+
* ArcadePhysics.Body has a deltaMax object, which allows you to cap the delta applied to the position to +- this value.
83+
* ArcadePhysics.Body now checks the Sprite scale automatically and adjusts the body size accordingly (fix #608)
84+
* Emitter.particleClass can now be set to any object that extends Phaser.Sprite, which will be emitted instead of a regular Sprite.
85+
* There is a brand new PhysicsEditor export script specifically for Phaser (in the resources folder), and new p2 polygon parsing functions thanks to georgiee.
86+
87+
488
Version 2.0.0 - "Aes Sedai" - March 13th 2014
589
---------------------------------------------
690

7-
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available. In the guide we detail the API breaking changes and approach to our new physics system. The following is a list of all the other new features, updates and bug fixes present in this release.
8-
991
New features:
1092

1193
* Phaser.Image is a brand new display object perfect for logos, backgrounds, etc. You can scale, rotate, tint, blend an get input events from an Image, but it has no animation or physics body.

src/time/Timer.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,13 @@ Phaser.Timer.prototype = {
153153

154154
var tick = delay;
155155

156-
if (this.running)
156+
if (this._now === 0)
157157
{
158-
if (this._now === 0)
159-
{
160-
tick += this.game.time.now;
161-
}
162-
else
163-
{
164-
tick += this._now;
165-
}
158+
tick += this.game.time.now;
159+
}
160+
else
161+
{
162+
tick += this._now;
166163
}
167164

168165
var event = new Phaser.TimerEvent(this, delay, tick, repeatCount, loop, callback, callbackContext, args);

0 commit comments

Comments
 (0)