Game Development Community

Selecting Regions of a map in a GUI Screen

by Julie B · in Torque Game Engine · 11/02/2004 (1:35 pm) · 1 replies

I am trying to created a Real-Time-Strategy style level selection screen (a la Command and Conquer) where you can select which battle you would like to enter next.

I have a map of the world and I want certain sections of it to be selectable. Unfortunately, the sections that I want to click on are not rectangular, and they may be diagonally adjacent to each other (so I do not want the selectable regions to overlap).

What would be the easiest way to do this?

Some potential solutions:
1. Create a special button class that is not rectangular and make a new button for each location that is selectable.
2. Keep track of the x,y coordinates where the mouse was clicked, then iterate over a structure containing information about each selectable area and try to determine if the click was within any of the irregularly shaped selectable regions.

Any thoughts?

#1
11/02/2004 (7:06 pm)
Use a TS control to render a 3d scene, and do raycasts from the mouse cursor to find out what geometry it is over. Use a seperate DTS shape for each selectable thing. Then figure out which shape you're over and bob's your uncle. Bonus points if you use the mission editor to create the scene.