Game Development Community

Mouse scripts linked to specific images?

by Daniel Horton · in Torque Game Builder · 05/05/2006 (9:15 pm) · 5 replies

Hello again,

My entire programming backround revolves around flash and, as a consequence, actionscript. When I wanted to make something happen when a user clicked on an image, I would just tie the script for the desired action directly into the image itself. Is there a similar way to do this in Torquescript? Everything I've seen seems to deal with monitoring coordinates of the mouse in the scene, as opposed to starting said action when the mouse is hovering over an image with a script attached to it.

#1
05/06/2006 (12:49 am)
If you check TDN, there are several excellent tutorials that cover mouse use (clicking, drag and drop and so-on) as well as the RTS tutorial which goes a bit further (drawing boxes around units to select them).

I know the RTS tutorial needs some updating to run with Beta 2, but I.m not sure about the other ones.
#2
05/06/2006 (11:27 am)
I think there is a callback function like onEnter (name may not be right) that is called when the mouse enters a t2dsceneobject. Search in the reference file, look through the callback functions.

You can give different objects different "sprits" in this way, i think.
#3
05/06/2006 (5:36 pm)
I think I found what you were talking about {onMouseEnter}, but it seems to register when the curser comes into the scene window itself, and not an object within it. If anyone has any other ideas, or if I misread what onMouseEnter actually does, any help would be great
#4
05/07/2006 (4:28 am)
Download the wack-a-mole mini game tutorial. It shows how to do exactly what you are asking. The thread with the link is here:
www.garagegames.com/mg/forums/result.thread.php?qt=43354

The user name/pw is further down in that thread.
#5
05/07/2006 (8:35 am)
I'm knee deep. That was perfect. Thank you so much.