Jump to content

Can't jump


hotgeart
 Share

Recommended Posts

Hi,

Sorry for my bad english.

I'm new in the world of html5 game and I'm trying to follow the tutorial from the book. I've an issue, I can't jump. I've no idea why.

A link for testing : http://not more online

If you look at the console, it's detecting the key up and if the player is touching the floor. But not the "JUMP!" and the velocity Y of course.

The code ( from : http://not more online ) :

Line 57if (this.cursor.up.isDown && this.player.body.touching.down) {    console.log('JUMP!');    this.player.body.velocity.y = -320;}

Thanks for your help.

Link to comment
Share on other sites

Ok it's work. Can you explain the problem ?

 

thx

You were checking this.player.body.touching.down before you called the Arcade Physics collide() method, thus it was always false when you checked it in your jumping code. Until you call collide() the Player object's body is not tested for touching anything...
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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