How to accurately depict the border of a sprite?

Hi guys, I’m new.
This my question. E.g:
tibet
I was insert a PNG as a sprite, and I want to engine detect mouse hover the map ( A in the pic ) in sprite and do something, not include other transparent place( B in the pic ). Problem is the engine just detct mouse hover whole sprite ( inclue transparent place), How to fix it ?

Thanks !

There is not a way in the engine to only have it detect nontransparent pixels of a sprite.

Your best bet would to update its collision box to be something close, then attach a small sprite to your mouse cursor point via events.

Note that collision boxes can only be convex, so you may need to add multiple polygons to the sprite.

1 Like

ok, got it. Thanks a lot.

If all shapes have a different color, you can use the get color extension and get the color at the position of MouseX/MouseY position and use it to know which one you are hovering

2 Likes