In my game I have 10 levels.
Each level has coins I’d like to use to unlock the next levels.
For example:
level 2: 10 coins
level 3: 20 coins
and so on … how could I do that?
Thanks in advance.
In my game I have 10 levels.
Each level has coins I’d like to use to unlock the next levels.
For example:
level 2: 10 coins
level 3: 20 coins
and so on … how could I do that?
Thanks in advance.
Quite a simple goal really but how you go about it would depend upon how you setup your Levels and how the player accesses them for example if you click the levels from a main menu i’ve written a small example that assumes your levels are accessed by GUI but you should be able to make simple changes to implement it for your desired use.
// points we're checking.
int points;
// gui to be placed in OnGUI to enabled/disable buttons.
// check if we have 10 points
if(points > 10) {
// if we do have 10 points display a gui button for level 2
if(GUI.Button(new Rect(100,175,110,25),"Level 2")) {
Application.LoadLevel("1");
}
}
// the same as above except the points we check is 20 and
// the position height of the gui is a different value so
// they do not overlap, u can also use GUILayout to spread
// these buttons out over an area but i left it out as not
// to over complicate.
if(points > 20) {
if(GUI.Button(new Rect(100,205,110,25),"Level 3")) {
Application.LoadLevel("2");
}
}
Hi friend, can this be applied to characters, ie unlock a character with 100 points?
if so please advise if you can