hey I am making a game arcade i have created 10 small Javascript games and just want to put them into an arcade in a 3D world well i have made the arcade assets and all that is working well i got a 3d character that uses the mouse input to move about the room. the problem is at the moment i have a machine for each game and when the character walks over to it the character triggers a GUITexture to appear saying press the space button this all works then 3 seconds later it disables again. what i want to happen is when the GUITexture is enabled you can press the button but when it isn’t enabled i want it to not be able to be used.
But the second part to this is i would like to be able to use the same button for all 10 machines so when you walk over to them you press enter and it takes you to that game.
any help would be much appreciated the only scripting language i want to use is javascript thanks in advance.
this is the code for the GUI sign to show
var sign : GUITexture; // the GUI Texture that will appear
var myTimer : float = 3.0; // the Timer that will enable and disable the GUI texture
sign.enabled = false; // this makes sure that the GUI texture doesn't appear before you become close to the machine
function Update () {
if (myTimer > 0) {
myTimer -= Time.deltaTime;
myTimer = Mathf.Round(myTimer*100)/100;
} // end of the timer function
if( myTimer <= 0 ) {
sign.enabled = false;
}
if (Input.GetKeyDown (KeyCode.Space))
Application.LoadLevel("ArcadeUI");
} // this is the end of the function update
function OnTriggerEnter () {
myTimer = 3.0;
sign.enabled = true;
} // end of the OnTriggerEnter