Jump to content

Friction with TileMapLayer and Arcade Physics


sanojian
 Share

Recommended Posts

I can't figure out how to make friction work between a crate that the player can push and the collision layer that is a TileMapLayer.  Does anyone know how to do this?   Here is what I tried.

// in create	layerCollision = map.createLayer('collision');	game.physics.enable(layerCollision, Phaser.Physics.ARCADE);	layerCollision.body.friction.x = 1;	crates = this.game.add.group();	game.map.createFromObjects('objects', 12 , 'crate', 0, true, false, crates);	game.physics.enable(crates, Phaser.Physics.ARCADE);	crates.enableBody = true;	crates.setAll('body.friction.x', 1);// in update	game.physics.arcade.collide(crates, layerCollision);

The player can push the crate, but it keeps sliding like it is on ice.  I want it to stop when the player stops pushing it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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