Jump to content

Multiple actions on a single key


Dlost1
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...