Jump to content

Phaser.Keyboard.MINUS does not trigger -


JcKairos
 Share

Recommended Posts

I am working on a game which allow the player to enter the answer for math questions.

Codes for typing the numbers are working such as:

key1 = this.game.input.keyboard.addKey(Phaser.Keyboard.ONE);
        key1.onDown.add(this.press1, this);

However, I can't seem to get the minus(-) working, it does not even trigger the key pressed.

keyminus = this.game.input.keyboard.addKey(Phaser.Keyboard.MINUS);
        keyminus.onDown.add(this.pressminus, this);

Is there any way I can implement the typing of '-'?

Link to comment
Share on other sites

19 minutes ago, samme said:

game.input.keyboard.addCallbacks(this, null, null, function (stringFromCharCode, event) {
  console.log(stringFromCharCode, event);
});

 

Got it working... for some reason the charCode was not 45 but 173...

Thanks for the help

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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