Jump to content

Dragging Sprite does not Respect .body.immovable on Other Sprites


jen
 Share

Recommended Posts

In the example section there is something close to what I would like

http://phaser.io/examples/v2/arcade-physics/sort-direction#gv

 

You can move phaser man around with the keyboard and the veggies do not move due to

c.body.immovable

I would like this behavior but when dragging instead of by keyboard.  When I change "player" to 

   sprite.inputEnabled = true;   sprite.input.enableDrag(true);

The dragged player goes behind the veggies :(.  I would like player to bump into the veggies as it works in the example just by dragging instead.

 

Any thoughts?

Link to comment
Share on other sites

Pretty sure if you're dragging directly then the position is getting set to the pointer's location instead of the sprite taking part in the physics world. Like, it's velocity is 0 even though the position is changing.

 

You might try dragging an invisible sprite sitting on top of your player and setting the player's velocity so that it moves towards what you're dragging, see if that works and gives a good experience?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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