Sanju

body.onFloor(), body.blocked.down and body.touching.down allways to false

Recommended Posts

Hello,
 
I'm making my first steps with phaser working on a simple platformer for learning, and I found a problem I can't figure how to solve. The problem is that I want the player to be able to jump only when it's on ground but I tried using  body.onFloor(), body.blocked.down and body.touching.down and I'm allways getting false return. I must be doing something wrong, but I don't know what it is. When I disable the collisions with tiles it works OK with player.body.collideWorldBounds = true; Could somebody help me, please?

 

Here is my tilemap creating code:

            this.map = this.game.add.tilemap('myTileMap');            
            this.map.addTilesetImage('pencilMan', 'pencilMan');
            this.layer = this.map.createLayer('Capa de Patrones 1');
            this.map.setCollision(9,true);

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.