Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Tweening when input from keyboard occurs.


ramako
 Share

Recommended Posts

 update: function () {         if (this.input.keyboard.isDown(Phaser.Keyboard.DOWN) && cursor.canMove){             cursor.canMove=false;              this.permitirMovimiento();             tween.to({ y: 450 }, 200);             tween.start();                    }        else if (this.input.keyboard.isDown(Phaser.Keyboard.UP) && cursor.canMove){             cursor.canMove=false;            this.permitirMovimiento();             tween.to({ y: 340 }, 200);             tween.start();             

Hi guys,

I'm using Phaser.io and I want to make a menu screen, where the user can choose either Play or Credits (for example) through keyboard. To reflect this, I am using an arrow that when the user press UP or DOWN the arrow will move accordingly, pointing to the option choice (either Play or Credits).

 

permitirMovimiento is a function that uses time.events.add to add some delay and turns the property of canMove to true .

 

Problem is, the cursor goes crazy after a few inputs, going up and down up and down in some loop that seems like keeps getting longer every time an input is received.

 

Any advices? I've been banging my head over this for some time already.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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