Jump to content

How do I make something like a floor immovable?

A Derpy Cat

Recommended Posts

something like this works:

// create a sprite without an image as a child of the skeleton
var floor = game.add.sprite(0, 0, null);

// enable physics so collision applies

// add a little offset so it's along where the skeleton is standing
floor.anchor.setTo(0, -1);

// create a floor long enough for the particle to land onto and not fall off
floor.body.setSize(400, 1, -200);

// we don't want the floor to move when the collision kicks in
floor.body.immovable = true;

You can see this in action here - https://www.programmingmind.com/phaser/stop-particles-from-sliding-in-phaser (my site)

Link to comment
Share on other sites


  • Recently Browsing   0 members

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