chrisoffiong Posted April 28, 2019 Share Posted April 28, 2019 var self = this this.map = this.add.tilemap('map') let tilemap = this.map.addTilesetImage("Cave", 'level_1') this.ground = this.map.createStaticLayer('Ground', tilemap).setDepth(-1) let rocks = this.map.createStaticLayer('Rocks', tilemap, 0, 0) this.map.setCollision(1214,true, 'Rocks') rocks.immovable = true; // rocks.collideWorldBounds = true console.log(rocks) function addPlayer(self, playerInfo) { player = self.physics.add.sprite(playerInfo.X, playerInfo.Y, 'player') player.setCollideWorldBounds(true); player.onWorldBounds = true; self.physics.add.collider(player, rocks) } Hey guys I'm having issues getting the top rock layer to have a collider effect. I've been lurking here and have tried the numerous solutions of all the resources here to no avail. I've played around with changing whether it was this.map.setCollision or rocks.setCollision, but I'm certain the index for the rocks in the tilemap is 1214. Any insight on this issue will save me a great headache. Thanks in advance guys! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.