Jump to content

How to add Space Bar as Button Up


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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