Ok so heres the deal, i want to make a game with around 50 levels that the player can select in the menu, my biggest problem is that i don’t know how to write one script (Java script) for all of them but i know how to write one for each level. Writing 50 scripts for the levels and then another 50 for the in game levels seems quite a lot. So this is what i want to achieve, i want to have the first level selectable but the other transparent gray so the player knows that he/she has to finish the first one to unlock the second one and so on. Does anybody know how to do this ? :?
Anyone ? Not even a hint ?
You may have to use two different GUIStyle : one for unlocked levels, one for locked levels.
hey i have a script that can work
var isQuitButton = false;
var isLoadButton = false;
var isControlButton = false;
var isBackButton = false;
function OnMouseEnter()
{
//change the color of the text
renderer.material.color = Color.red;
}
function OnMouseExit()
{
//change the color of the text
renderer.material.color = Color.white;
}
function OnMouseUp()
{
//are we dealing with a Quit Button?
if( isQuitButton )
{
//quit the game
Application.Quit();
}
//are we dealing with a Laod Button?
if( isLoadButton )
{
//load level
Application.LoadLevel(1);
}
//are we dealing with a Control Button?
if( isControlButton )
{
//load level
Application.LoadLevel(2);
}
//are we dealing with a Back Button?
if( isBackButton )
{
//load level
Application.LoadLevel(0);
}
}
i think you could be able to change this
you might be able to replace
var isQuitButton = false;
var isLoadButton = false;
var isControlButton = false;
var isBackButton = false;
with
var islevel1Button = false;
var islevel2Button = false;
var islevel3Button = false;
var islevel4Button = false;
or mabey
var is1Button = false;
var is2Button = false;
var is3Button = false;
var is4Button = false;
and for the stuff below
function OnMouseUp()
you would just change accordingly
example
if change
var isloadButton = false;
to
var is1Button = false;
you would change
//are we dealing with a Load Button?
if( isLoadButton )
{
//load level
Application.LoadLevel(1);
}
to
//are we dealing with a 1 Button?
if( is1Button )
{
//load level
Application.LoadLevel(1);
}
then for it to work in your game you would make a GUI text and on that text put 1 or level one make sure the GUI text is in the game screen and make sure to put a box colider on your GUI text the add your script to the text then for what ever level you want to load check the box that is in the inspector of your text if you need more help just ask
Thank you for your replies, thou i forgot to mention that im not using guiText but 3d text.
Thanks
yo dude i dont think that you can interact with 3d text i think you have to use GUI :shock:
so i would try that but if you cant i will be at my home in a week and i will make a video tutoial if you want. i cant help you if you are useing 3D text
sorry but if you want help with the gui text i will be glad to help and i will give you any information you need until i can make a video tutoial. later