Jump to content

Problem with basic collision


Recommended Posts


//simple spelling error
this.walls.setAll('body.immovable', true);

//changed from game.add.sprite to this.walls.create since mid1Wall is being added to this.walls
//physics group
var mid1Wall  = this.walls.create(game.width/5*1, game.height/6*2 -40, 'wall');


changing these allows the player body sprite to interact with the walls physics group. The last parameter for the sprite constructor is the sprite's frame, but there are other ways to add multiple sprites to a physics group. This should allow this.player.body.touching.down to return true, allowing your conditional to proceed (but you should always test and debug if your unsure :)

Also check out these resources for reference:



Link to comment
Share on other sites


  • Recently Browsing   0 members

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