Game Development Community

Mouse events on stacked items

by Lance Hampton · in Torque Game Builder · 11/06/2006 (9:29 am) · 2 replies

I'm not sure where to put a question about mouse events but since they are defined by collision bounds, I'll go with this area.

I have a cute little game going where I shoot some things. It works great. Then I added in a wall that things pass behind. I can shoot straight through the wall. Is there some way to have a mouse event on the foremost layer?


The answer to this would be huge to me, but even better would be some resource that I've overlooked that defines how mousevents work other than just the basic API. I feel like I'm missing something that would be obvious to people with experience doing GUI work.


Hmm...now that I think on this, is it a matter of turning on mouse events on the wall and it would be handled there and not passed through?

#1
11/06/2006 (1:28 pm)
Maybe this is relevant or maybe not, hopefully it helps ;)

When it comes to many mouse events such as clicking, the event can be consumed by every object at that location on the screen. So the event would be consumed by the wall, the object behind it, and the backdrop behind that, if all three were set up to receive mouse events. There was a huge thread about this recently, I wish I could find it and link it here.
#2
11/06/2006 (5:03 pm)
Ok, that exactly describes what's happening. Is there a way of handling that using strictly event callbacks, or am I going to end up doing a raycast (or the TGB equivalent) and checking for any other collisions above it?

I don't mind the work involved in that but I'm new to GUI programming and would prefer to learn it the right way. I'll be looking for that thread.