mirror of
https://github.com/wassname/phaser.git
synced 2026-07-18 12:30:44 +08:00
Fixes #382 Error when using InputHandler#onInputUp & sprite destroys itself during the event.
This commit is contained in:
+12
-4
@@ -14,14 +14,16 @@ var p;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#ff5500';
|
||||
// game.stage.backgroundColor = '#ff5500';
|
||||
|
||||
game.renderer.useFillRect = false;
|
||||
// game.renderer.useFillRect = false;
|
||||
|
||||
sprite = game.add.sprite(0.5, 0, 'pic');
|
||||
sprite2 = game.add.sprite(0, 300, 'pic');
|
||||
// sprite2 = game.add.sprite(0, 300, 'pic');
|
||||
|
||||
game.input.onDown.add(tint, this);
|
||||
sprite.inputEnabled = true;
|
||||
sprite.events.onInputDown.add(tint, this);
|
||||
sprite.events.onInputUp.add(wibble, this);
|
||||
|
||||
// game.add.tween(sprite).to({y: 500}, 3000, Phaser.Easing.Linear.None, true);
|
||||
|
||||
@@ -37,6 +39,12 @@ function tint() {
|
||||
|
||||
}
|
||||
|
||||
function wibble() {
|
||||
|
||||
console.log(sprite);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user