Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by odiemiranda

Hi,

I'm really very new with this engine, and i trying to do a mouse pickup on an entity in the game, how will i know if the mouse is hovering an entity?

Hope someone can help me out.

Thanks

1 decade ago by MikeL

Refer to this previous post about how to handle clicking.

1 decade ago by odiemiranda

Hi MikeL,

Would this work with an odd shape'd image like for example building at is overlapping with each other, would you detect the one on front or the one at the back?

Thanks

1 decade ago by MikeL

Hi odeimiranda. Welcome aboard.

Good question. I've been fooling around with this a bit for a project I'm working on. I'm hoping at some point to create a simple app that shows the basics of hovering, clicking and dragging. Unfortunately, I probably won't get to that for another week or so.

In the meantime, the short answer is that if you take Dominic's example and replace click functions with hover functions (no need to check for actual clicking from the input) what will happen is that the pointer's check function will check every entity that is in contact with the pointer - front, back or otherwise. So if the pointer is over three overlapping entities, each entity will be "hovered".

To actually only select the topmost entity, you would need to examine the z index most likely. Alternatively, as soon as one entity is "hovered" then turn off hovering for the pointer until the pointer leaves that entity. I believe this will select the topmost entity.

Hope that is a start for you.
Page 1 of 1
« first « previous next › last »