mariogarranz Posted February 2, 2015 Share Posted February 2, 2015 I had a game prototype which worked just fine. Then, when refactoring and tyding up code, the player object stopped detecting collisions against the tile map, as well as overlapping with certain objects. It still detected collisions against world bounds though.After some tests, I noticed that if I replaced this code in the State: update: function(){ this.game.physics.arcade.collide(this.player, this.collisionLayer, this.playerCollides, null, this); ...}With this code in the extended Sprite class: MyGame.Player.prototype.update = function(){ this.game.physics.arcade.collideSpriteVsTilemapLayer(this, this.collisionLayer);...};It works.Any idea on why is this happening? I would like to keep some of the overlapping checks inside the State update function, not in the Player update. Link to comment Share on other sites More sharing options...
mariogarranz Posted February 2, 2015 Author Share Posted February 2, 2015 OK after reading through the Arcade physics source code I found my own mistake.My extended Sprite class was using a "type" attribute, which was overriding the original one, and therefore the collision handler didn't expect it to be a Sprite.Stupid mistake, almost one hour debugging Link to comment Share on other sites More sharing options...
Lee Kao Posted February 2, 2015 Share Posted February 2, 2015 Maybe it's not your mistake but a namespacing problem, I can imagine other people encountering this issue. Link to comment Share on other sites More sharing options...
Recommended Posts