Jump to content

sprite.body.touching.down? What triggers it boolean to be true?


Recommended Posts


Been going through the Book Discover Phaser, but are stuck with this bit of code: 



if (this.cursor.up.isDown && this.player.body.touching.down) {

// Move the player upward (jump)

this.player.body.velocity.y = -320;



The jump functionality on the player somehow doe's not work. When I console.log the body.touching object, I can see, that body.touching.down does not turn true, when the player hit's the a platform. Furthermore, the cursor.up is detected when I leave out this bit of code: '&& this.player.body.touching.down', but somehow does not function, when the code is as in the Quote. Any Ideas to what I should be looking for? Thanks.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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