Jump to content

Define an area to drop an element


kgoedert
 Share

Recommended Posts

Hi,

 

I just started trying out phaser. I would like to build a simple game where I have some clothes items like a shoe, a hat... and I have a doll which I should dress up with this items.

 

So far, I was able to place all the items on the game, and make the clothing items draggable. My question is: how can I define that a specific region of the doll can have an item dragged into it, like the head, but not other parts, like the hands or body?

 

Thank you

 

Kelly

Link to comment
Share on other sites

There are lots of ways to approach this. Personally I would use a hidden 'hit area' on both the piece being dragged and the 'body'. Two circles would be good. Then when the item is dropped check if they intersect at all, and if they do you've got a well placed item you can move to where it should be.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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