Game Development Community

Create a PNG with some "hot zones" clickable

by Pierre78 · in Torque Game Builder · 07/16/2009 (10:34 am) · 6 replies

Hi evryone,

I'm currently learning TGB and I would like to know how to create a PNG "map" with some special "hot zones" which would respond differently to the mouse when the cursor comes over them, click them or leave them.

For example, a PNG picture of 512 X 512 pixels with several areas of 20x20 pixels placed as some special zones definied on the original PNG picture. Is it possible to define some squares, some rectangles, some circles zone on this PNG picture ?

Thanks for your help,

Pierre

#1
07/16/2009 (10:49 am)
two ways you could approach this would be to create a bunch of non-overlapping scene objects that would each be their own 'hot zone' that would fire the logic when clicked.

..or..

you could handle the onclick of the actual image and process where the mouse was clicked to handle the events.

I'd probably go with the first one though...
#2
07/17/2009 (1:30 am)
yep... i think the 1st approach is the best, can be a lil bit convoluted, but will get you there w/o fail... just remember to activate the mouse interaction with such objects, or you'll be wondering all the time, why it doesnt work.
#3
07/17/2009 (9:40 am)
Thanks for your reply, you mean by using some invisible sprites placed over the PNG picture at the hot zones ?
#4
07/17/2009 (10:41 am)
You don't need to use sprites... Use a "Scene Object" under the "Other" menu on the right side of TGB. It's just a plain old, generic object. In your case, a mouse click catcher. :)

Best of luck,
Patrick
#5
07/18/2009 (10:09 pm)
Thanks very much for your support !

Have a good week end,

Pierre
#6
11/06/2009 (8:39 pm)
Hi, I know this thread has been dead for a while, but it's on topic for my questions.
New to TGB...

I like the idea of using a Scene objects over the map, but I was wondering if anyone had some input on a couple of other things I'd like to accomplish in the game I'm going to work on.

I'd like a color overlay that is at lease partially transparent, dependent on the player who controls a given territory. It would change from time to time obviously. Also would like it to Highlight when selected. How might that be implemented?

I also want to allow each territory a specialty which is assigned randomly when ever a new game is started. For instance, none, mountain, field, etc. Could I create another Scene object below the clickable one that could have the potential of displaying the different states? Almost like an animated gif, each frame being assigned to represent a state and then having the game display the correct one? I think that's probably a big question...

Please feel free to simply point me in the right direction
and thanks in advance.

Also, I don't have Pro but I am willing to upgrade if special engine changes are required...