Jump to content

Tilesheet layer collision


petersbob
 Share

Recommended Posts

I have a player that is walking on a layer of my tilesheet. Everything will work, but every once in a while my player will fall or jump through the layer.

 

I feel my problem may be in the setup of my collision. I don't understand what setCollisionBetween and setCollisionByExclusion mean exactly and why I would use one over the other.

 

This is what I currently have that sort of works.

this.physics.startSystem(Phaser.Physics.ARCADE);        this.gameover = false;        this.map = this.add.tilemap('level1');        this.map.addTilesetImage('tiles', 'gameTiles1');        this.map.addTilesetImage('simples_pimples', 'gameTiles2');        this.map.addTilesetImage('trees', 'gameTiles3');        this.add.image(0, 0, 'bg');        //this.objectsLayer = this.map.createLayer('objects');        this.blockedLayer = this.map.createLayer('Platforms');                this.backgroundLayer = this.map.createLayer('Background');        //this.map.setCollisionBetween(0, 2000, true, this.blockedLayer        this.map.setCollisionBetween(0, 2000);

and in my update

this.physics.arcade.collide(this.player, this.blockedLayer );
Link to comment
Share on other sites

  • 3 weeks later...
 Share

  • Recently Browsing   0 members

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