Jump to content

Best way to do Pickable objects (like coins in Mario)


ZoomBox
 Share

Recommended Posts

Hello !

I'm wondering what would be the best way to have pickable objects (with Physics.P2) ?

 

I mean, I wan't to be able to interact with this item by its body but without it to be blocking me.

 

The scenario would be: I have a Player class, a Pickable class (a coin). Once the player's body touches the coin's body it fires an event (like onBeginContact) but never blocks me.

 

It looks possible with:

-Sprite.overlap (but not accurate at all)

-Solid bodies and body.onBeginContact(...) then I immediatly clearShapes (but it's not clean, and the player will still be stuck 1 frame)

...

 

Thank you :-) !

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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