Jump to content

Jumping on a Tilemap


Recommended Posts

I've always been using the following method to allow a player to jump from a sprite object.

if (cursor.up.isDown && player.body.touching.down) {player.body.velocity.y = -300}
else {player.body.velocity.y =200}

But, using a tilemap, the previous method does not work.

I've also tried





without success.

Is there any way to allow a player jump on a tilemap?


Link to comment
Share on other sites

Refer to https://phaser.io/examples/v2/tilemaps/map-bounce; it shows loading in a tilemap and having a character jump on the tiles.


L27: map.setCollisionBetween(1, 12);


L48: game.physics.arcade.collide(sprite, layer);

Also... 'does not work' and 'without success' are not quite clear so I'm not sure what your exact issue is. Does the character not collide with the tiles? does he not actually jump at all? etc...

Link to comment
Share on other sites

  • 1 year later...

  • Recently Browsing   0 members

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