Download

Quickest Way to Implement MouseOver/Clicking on Sprites?

As part of a 2D game I’m trying to allow mousing over and clicking on an icon, but things seem a bit more tedious and hard to follow than I was expecting.

My Blueprint class for the icons currently consists of some data and a Flipbook attached to the Default Scene Root. I have the icons displayed in the proper positions and now I need to be able to hover and click on them, which I assume probably involves the collision area of the Flipbook’s sprites and possibly enabling collisions in various places…? (I suspect it could be tricky to know what to enable if you don’t know exactly what you’re doing)
Either way, there’s an Event ActorBeginCursorOver which seems to be part of what I need, but it mentions using the Clickable interface which is probably why it doesn’t work. I’ve tried implementing the Clickable interface but it’s not in the Add list so I don’t know how that works.

Or is it likely that it should work by default, and that I just have some collision settings turned off? I’ve seen a video tutorial where the event just has to be placed in the event graph and it works right away, so maybe I just have incompatible collision settings or maybe the tutorial didn’t show everything or it’s different with starter content 3D props…

I suspect I could just get the mouse coords and the coords of the icons (which I’ve already done actually… before I thought the built-in functionality might be a better idea to use) and then use the distance between 2 points formula to detect if the mouse is over, but I’ll leave that for in case I can’t figure the “easy” way out or if it seems too complicated.

Wait… I changed a collision setting the Flipbook and it seems to be working now. Never mind. I’ll post again if I have any more trouble/questions…