Game Development Community

Client-side radar

by Brendan Dillon · in Torque Game Engine · 08/09/2005 (4:04 pm) · 2 replies

Hi

I've added this resource:

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2270

to my game and I works great, now i'm trying to expand on it so that aswell as showing bots the radar will also display keys that the player must select in my game, I don't want any other items such as health packs to appear on the radar.

If anyone had used this code in the past or has any pointers on the best way to expand on it I would be very greatfull for your help


regards

Brendan

#1
08/10/2005 (6:53 am)
Have a look at the OnRender code. It has a getType() check for a certain type mask such as PlayerObjectType. You need to change that to include the type of your key object, for example (PlayerObjectType | StaticShapeObjectType) assuming your keys are static shapes.

Then you just need a check inside the loop and to change the colour accordingly. There are a number of ways you could test whether a given object is a key or not. For example if all your keys use the same datablock called "KeyObject" you could edit the render loop to be

if ( (shape->getType() & StaticShapeObjectType) && 
        (!dStricmp(shape->getDataBlock()->getName(), "KeyObject")) )
   {                
      glColor4f(1.0,1.0,0.0,1.0);   // Yellow dots for keys                     
      glVertex2f(newCoord.x,newCoord.y); 
   }
   else{ // check for other shape types and colour accordingly
   }...
#2
08/11/2005 (1:58 pm)
Thanks for the help Gary!