dbseraph Posted August 6, 2014 Share Posted August 6, 2014 I am trying to add a jump to my game, but for some reason the detection is not working. As you can see in the image, the debug.bodyInfo (in-game) shows the blocked.down bool is true. I have my jump key to dump the blocked object to console, and as shown it still says blocked.down is false. The blocked.down does show correctly in console when the sprite is at the very bottom of the screen, which is why the "JUMPING!" line fired once. The sprite landed on the platform above it, but wouldn't jump after that. The layer is a tilemap, set as so: this.bg = this.add.tilemap('level');this.bg.addTilesetImage('level_sheet', 'tiles');this.layer = this.bg.createLayer('layer_1');this.bg.setCollisionByExclusion([12], true, this.layer);This is the jump code: // jump if (this.input.keyboard.justPressed(jump)) { if (this.player.body.blocked.down) { this.player.body.velocity.y = -600; console.log("JUMPING!"); } console.log(this.player.body.blocked); }Any help is appreciated! Link to comment Share on other sites More sharing options...
lewster32 Posted August 6, 2014 Share Posted August 6, 2014 Try changing body.blocked.down to body.touching.down - touching.down will always return true when the bottom of the object is colliding with another. Link to comment Share on other sites More sharing options...
dbseraph Posted August 6, 2014 Author Share Posted August 6, 2014 That is actually what I originally tried, following a phaser example. But as you can see in the image, body.touching.down is also reading false. It reads false consistently however. body.blocking down reads true in the game.debug output. Link to comment Share on other sites More sharing options...
jojomanzo Posted February 10, 2017 Share Posted February 10, 2017 (edited) wrong window Edited February 11, 2017 by jojomanzo replied in wrong topic Link to comment Share on other sites More sharing options...
Recommended Posts