Search the Community
Showing results for tags 'phaser sprite input'.
-
Hey, I'm trying to get sprite to follow path user created after mouse up event. i think I need to add timer here or use the update loop, but not sure how. help will be appreciated strategy: enable history, add event to sprite, iterate over history and travel along the XY coords code: newSprite: function (parent, x, y, sideStr){ var sprite= parent.create(x, y, sideStr); sprite.rotation = 1.61; sprite.inputEnabled = true; sprite.events.onInputDown.add(this.onD, this); sprite.events.onInputUp.add(this.onU, this); return sprite; }, onU : function(sprite, pointer){ var speed = 200; if(sprite.key === "enemy" || !pointer._history.length) return; pointer._history.forEach(function(v){ if(speed + 1 < 500) speed++; this.game.time.events.loop(Phaser.Timer.SECOND); this.game.physics.arcade.accelerateToXY(sprite, v.x, v.y, speed, 900) })
-
in Phaser 1.1.6 i start input events of sprite this: sprite.input.start();but Phaser 2.0 is can't start. it's ask me start(); is null Thank you #rich