Jump to content

Jumping: touching and blocked


chon27
 Share

Recommended Posts

I am having problems jumping in my game.

 

1st. I use key.isDown to determinate the jump of my sprite. But if I hold key of the jump, my character is jumping all the time. I want to push the key once and wait to another key press to do a new jump.

 

2nd. I draw the map with json using a file made by tiled. This tiles work with sprite.touching, they are not work by sprite.blocked. Then in my game I draw new blocks with sprite.create function and they work with sprite.blocked only. What is the difference? By the way I have some problems with sprite collisions in this new blocks, I can stick to the walls like this while hold left cursor.

 

post-10576-0-21908800-1411412025.jpg

 

I have Phaser v2.0.5.

Link to comment
Share on other sites

1: This example shows how to use keyboard events instead of key states: http://examples.phaser.io/_site/view_full.html?d=input&f=keyboard+hotkeys.js&t=keyboard%20hotkeys

 

2: I believe (but I'm not entirely sure on this) that blocked is set when a sprite collides with an immovable object or the world bounds (when collideWorldBounds is true) whereas touching is set during any collision, but is immediately unset afterwards, and so must be checked inside the collide callback.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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