1 decade ago by Skywalker
I am trying to use different collision layers depending on what height the player is currently at.
this.collisionMaps is an array of the data arrays for different collision maps
is my change collision layer function in my main.js
it appears to do everything it's supposed to but when the layer supposedly changes, movement breaks. no errors thrown in console. If I comment out the "ig.world = ..." line, movement still works but the collision layer remains the same since it wasn't updated in box2d.
anyone know how to make this work?
this.collisionMaps is an array of the data arrays for different collision maps
var cMap = new ig.CollisionMap(ig.game.collisionMap.tilesize, this.collisionMaps[this.groundLevel], ig.game.collisionMap.tiledef); this.collisionMap = cMap; ig.world = this.createWorldFromCollisionMap(this.collisionMap); //this.setupContactListener(); this.activeCollisionLayer = this.groundLevel;
is my change collision layer function in my main.js
it appears to do everything it's supposed to but when the layer supposedly changes, movement breaks. no errors thrown in console. If I comment out the "ig.world = ..." line, movement still works but the collision layer remains the same since it wasn't updated in box2d.
anyone know how to make this work?