Jump to content

How to add Space Bar as Button Up


Fuzzy27
 Share

Recommended Posts

Hi,  i am a newbie in using Phaser and i am trying to figure out how i can add the space bar as key for "upwars" 

 

Therefore i was looking at phaser.js  how createCursors()  is realized and tried to enhance it like this 

 

 cursors = game.input.keyboard.createCursorKeys();
 cursors2 = game.input.keyboard.addKeys('up', Phaser.Keyboard.SPACEBAR);
 
 
but using it like
 
cursors2 = game.input.keyboard.addKeys('up', Phaser.Keyboard.SPACEBAR);
 
i get the error:
 
Unable to get property 'isDown' of undefined or null reference
 
 
Has anybody a hint how to solve that?
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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