Game Development Community

Turning off the crosshair

by Steve Montgomery · in Torque Game Engine · 04/28/2006 (3:45 pm) · 3 replies

I am working on a feature that requires the crosshair to be turned off.

I have looked through the forums and seen a few examples where it done like this:

crosshair.visible = 0;

Well, that doesn't work for me. There is no 'crosshair' GUI object explicitly declared in PlayGUI, so I am having trouble tracing the code.

Anyone have any ideas why this wouldn't work? I am trying this on the TGE 1.4 starter.fps demo.

#1
04/28/2006 (3:50 pm)
I figured it out, I think. In PlayGUI.gui the crosshair hud was unnamed. I named it "crosshair" and the on/off stuff using the 'visible' property worked. Here is the chunk of code I changed in PlayGUI.gui:

new GuiCrossHairHud(crosshair) {
      Profile = "GuiDefaultProfile";
      HorizSizing = "center";
      VertSizing = "center";
      position = "496 368";
      Extent = "32 32";
      MinExtent = "8 8";
      Visible = "1";
      bitmap = "./crossHair";
      wrap = "0";
      damageFillColor = "0 1 0 1";
      damageFrameColor = "1 0.6 0 1";
      damageRect = "50 4";
      damageOffset = "0 10";
         helpTag = "0";
   };
#2
04/28/2006 (8:36 pm)
Yup, needs a name to work, otherwise you're telling a blank (no object with such name) to be invisible.
#3
04/29/2006 (7:43 am)
I was actually following your scope HUD example... I just didn't see where you went in and named the standard crosshair. I assumed that there was some object declared in the Engine called crosshair that you could manipulate. But I figure out that wasn't correct after I dug through all of the code. It was a newb mistake.. oh well.