Dlost1 Posted February 14, 2017 Share Posted February 14, 2017 Hi:) I am trying to use one key (E) for 2 actions --> animation slashLeft and animation slashRight depending on the char facing left or right (to where the enemy will be) I came up with the stuff below...is there a better way? Please tell me there is:/ (so you can walk and hit at the same time, in example?) //More cursor-key-code above this else if(this.keyE.isDown){ if(cursors.left.upDuration(200)) { player.animations.play('slashLeft'); }else if(cursors.right.upDuration(200)) { player.animations.play('slashRight'); } Link to comment Share on other sites More sharing options...
scheffgames Posted February 14, 2017 Share Posted February 14, 2017 This is one way to do it. But if you change your char direction with the cursors keys store a bool somewhere telling the character current direction (isLeft = true). Then if the E is pressed execute the left or right animation depending on the bool. Link to comment Share on other sites More sharing options...
Recommended Posts