mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
Fixed issue where Stage.update wasn't called.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
ClassA = function(game, x, y, texture) {
|
||||
Phaser.Sprite.call(this, game, x, y, texture);
|
||||
}
|
||||
|
||||
ClassA.prototype = Object.create(Phaser.Sprite.prototype);
|
||||
ClassA.prototype.constructor = ClassA;
|
||||
|
||||
ClassA.prototype.update = function() {
|
||||
console.log("here");
|
||||
}
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('pic', 'assets/pics/questar.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
sprite = new ClassA(game, 100, 100, 'pic');
|
||||
|
||||
game.add.existing(sprite);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
}
|
||||
+9
-18
@@ -161,6 +161,15 @@ Phaser.Stage.prototype.postUpdate = function () {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.checkOffsetInterval !== false)
|
||||
{
|
||||
if (this.game.time.now > this._nextOffsetCheck)
|
||||
{
|
||||
Phaser.Canvas.getOffset(this.game.canvas, this.offset);
|
||||
this._nextOffsetCheck = this.game.time.now + this.checkOffsetInterval;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,24 +293,6 @@ Phaser.Stage.prototype.checkVisibility = function () {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs Stage processes that need periodic updates, such as the offset checks.
|
||||
* @method Phaser.Stage#update
|
||||
*/
|
||||
Phaser.Stage.prototype.update = function () {
|
||||
|
||||
if (this.checkOffsetInterval !== false)
|
||||
{
|
||||
if (this.game.time.now > this._nextOffsetCheck)
|
||||
{
|
||||
Phaser.Canvas.getOffset(this.game.canvas, this.offset);
|
||||
this._nextOffsetCheck = this.game.time.now + this.checkOffsetInterval;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when the document visibility is changed.
|
||||
* @method Phaser.Stage#visibilityChange
|
||||
|
||||
Reference in New Issue
Block a user