Game Development Community

Mouse events on invisible tiles?

by Brian Carter · in Torque Game Builder · 03/17/2008 (9:39 am) · 2 replies

Does anybody have any ideas on how to allow tiles that have been set to invisible, i.e %this.owner.setVisible( false ), to still recieve mouse events.

I have a call to %this.owner.setUseMouseEvents(true); inside the onBehaviorAdd function, and if I dont make the call to setVisible the tile receives and processes the mouse events as it should. However, when I make the call to setVisible and make the tile invisible mouse events arnt captured.

Anybody have any ideas how to force the events to still be captured, but keeping the tile as invisible?

There is also a reason why I need to use graphic tiles that can be made visible and invisible at will and receive mouse events regardless of visibility state on the screen. So substituting a SceneObject wouldn't work in this case.

#1
03/17/2008 (10:29 am)
Make a image that is completely transparent and set the tile to that value.

You'll have a visible but completely transparent tile. This should continue to behave exactly like all the other tiles.

%this.owner is this a tile? or the whole tile layer?


Are you really talking about tiles? or StaticSprites?
#2
03/17/2008 (10:37 am)
It's a static sprite tile (individual tile) .. and I need the graphic on it to be visible and not visible based on certain conditions. However, even with a non visible tile I need the mouse events to go through. %this.owner translates to the actual tile within the behavior. A pure transparent file, like a script object won't work. My only thought right now is possible to create an image map with the visible image on cell 1 and the transparent image on cell 2, and switch the frame at runtime instead of the visibility. Just wondered if there was a more elegant way of doing this and forcing events through.