danteAGAIN Posted July 2, 2017 Share Posted July 2, 2017 Hello everyone, I need your help , i try create a "rpg game" . I want use the left click (mouse1) for auto atk with my hero. my code: create: function(){ this.player.animations.add('atk', [529, 532, 535, 538, 541], 10, true); } update: function(){ if(game.input.activePointer.isDown){ this.player.animations.play('atk'); } with this code i need to keep my left click to push for see the action. And i want just to push 1 time. Sorry my english is very bad. Link to comment Share on other sites More sharing options...
Str1ngS Posted July 2, 2017 Share Posted July 2, 2017 You want to use the onDown signal on game.input: create: function(){ this.player.animations.add('atk', [529, 532, 535, 538, 541], 10, true); this.game.input.onDown.add(function () { this.player.animations.play('atk'); }, this); } Link to comment Share on other sites More sharing options...
danteAGAIN Posted July 2, 2017 Author Share Posted July 2, 2017 i can get inside the function but the animation doesn't work. I haven't error message in console. Link to comment Share on other sites More sharing options...
Recommended Posts