iShellz Posted April 28, 2014 Share Posted April 28, 2014 Anyone know how to make a button that fires evens when it is held down? Link to comment Share on other sites More sharing options...
marvster Posted April 28, 2014 Share Posted April 28, 2014 Hi iShellz, make a bool and set it to true when signal onDown and to false when signal onUp is dispatched.Check this bool in your update function.[..]this.isPressed = false;this.fireKey = game.input.keyboard.addKey(Phaser.Keyboard.S);this.fireKey.onDown.add(<function that sets isPressed true> , this);this.fireKey.onUp.add(<function that sets isPressed false> , this);[..]update: function() {[..]if (this.isPressed) { //add here }[..]}[..] iShellz 1 Link to comment Share on other sites More sharing options...
Recommended Posts