mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Phaser.Time physicsElapsed delta timer clamp added. Stops rogue iOS / slow mobile timer errors causing crazy high deltas.
This commit is contained in:
parent
94c7c57e1c
commit
7e5f38d022
6 changed files with 22 additions and 12 deletions
|
@ -137,7 +137,8 @@ Version 1.1
|
|||
* The default Game.antialias value is now 'true', so graphics will be smoothed automatically in canvas. Disable it via the Game constructor or Canvas utils.
|
||||
* Added Physics.overlap(sprite1, sprite2) for quick body vs. body overlap tests with no separation performed.
|
||||
* Fixed Issue 111 - calling Kill on a Phaser.Graphics instance causes error on undefined events.
|
||||
|
||||
* Phaser.Group now automatically calls updateTransform on any child added to it (avoids temp. frame glitches when new objects are rendered on their first frame).
|
||||
* Phaser.Time physicsElapsed delta timer clamp added. Stops rogue iOS / slow mobile timer errors causing crazy high deltas.
|
||||
|
||||
|
||||
Outstanding Tasks
|
||||
|
|
|
@ -3,8 +3,6 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:
|
|||
|
||||
function preload() {
|
||||
|
||||
game.world.setBounds(0, 0, 1920, 1200);
|
||||
|
||||
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
|
||||
game.load.image('card', 'assets/sprites/mana_card.png');
|
||||
|
||||
|
@ -15,6 +13,8 @@ var Keys = Phaser.Keyboard;
|
|||
|
||||
function create() {
|
||||
|
||||
game.world.setBounds(0, 0, 1920, 1200);
|
||||
|
||||
game.add.sprite(0, 0, 'backdrop');
|
||||
|
||||
card = game.add.sprite(200, 200, 'card');
|
||||
|
|
|
@ -50,15 +50,18 @@ Phaser.Group = function (game, parent, name, useStage) {
|
|||
if (parent instanceof Phaser.Group)
|
||||
{
|
||||
parent._container.addChild(this._container);
|
||||
parent._container.updateTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.addChild(this._container);
|
||||
parent.updateTransform();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.game.stage._stage.addChild(this._container);
|
||||
this.game.stage._stage.updateTransform();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +109,8 @@ Phaser.Group.prototype = {
|
|||
}
|
||||
|
||||
this._container.addChild(child);
|
||||
|
||||
child.updateTransform();
|
||||
}
|
||||
|
||||
return child;
|
||||
|
@ -133,6 +138,8 @@ Phaser.Group.prototype = {
|
|||
}
|
||||
|
||||
this._container.addChildAt(child, index);
|
||||
|
||||
child.updateTransform();
|
||||
}
|
||||
|
||||
return child;
|
||||
|
@ -183,6 +190,8 @@ Phaser.Group.prototype = {
|
|||
|
||||
this._container.addChild(child);
|
||||
|
||||
child.updateTransform();
|
||||
|
||||
return child;
|
||||
|
||||
},
|
||||
|
@ -217,6 +226,8 @@ Phaser.Group.prototype = {
|
|||
}
|
||||
|
||||
this._container.addChild(child);
|
||||
child.updateTransform();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -408,6 +419,7 @@ Phaser.Group.prototype = {
|
|||
this._container.removeChild(oldChild);
|
||||
this._container.addChildAt(newChild, index);
|
||||
newChild.events.onAddedToGroup.dispatch(newChild, this);
|
||||
newChild.updateTransform();
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -190,9 +190,6 @@ Phaser.Sprite = function (game, x, y, key, frame) {
|
|||
*/
|
||||
this.scale = new Phaser.Point(1, 1);
|
||||
|
||||
// console.log(this.worldTransform);
|
||||
// this.worldTransform = [];
|
||||
|
||||
/**
|
||||
* @property {Phaser.Point} _cache - A mini cache for storing all of the calculated values.
|
||||
* @private
|
||||
|
|
|
@ -113,9 +113,6 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|||
this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
|
||||
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
|
||||
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
|
||||
|
@ -241,11 +238,8 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|||
|
||||
this.angularVelocity = 0;
|
||||
this.angularAcceleration = 0;
|
||||
|
||||
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preRotation = this.sprite.angle;
|
||||
|
||||
this.x = this.preX;
|
||||
|
|
|
@ -202,6 +202,12 @@ Phaser.Time.prototype = {
|
|||
this.lastTime = time + this.timeToCall;
|
||||
this.physicsElapsed = 1.0 * (this.elapsed / 1000);
|
||||
|
||||
// Clamp the delta
|
||||
if (this.physicsElapsed > 1)
|
||||
{
|
||||
this.physicsElapsed = 1;
|
||||
}
|
||||
|
||||
// Paused?
|
||||
if (this.game.paused)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue