Need help with my level.

Hello all, I am just learning how to code. Trying to make a simple game where you are a box and trying to get to point A to point B. I also want to add a death counter.
But for some reason we the player hits the goal to get to the next level it doesnt do anything. I had it working before but not it just stopped working and I dont know why.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
public class GameManager : MonoBehaviour {
	public int currentScore;
	public int highscore;

	public int currentLevel =0;
	public int unlockedLevel;

	public GUISkin skin;
	public Color warningColorTimer;

	public Color defualtColorTimer;
	public int deathCount=0;
	public Rect timerRect;

	public float startTime;
	public string currentTime;

	

	void Update ()
	{
		startTime -= Time.deltaTime;
		currentTime = string.Format ("{0:0.0}", startTime);
		if (startTime <= 0)
		{
			startTime =0;
			Destroy (gameObject);
			Application.LoadLevel (1);
		}

	}


	void start (){

DontDestroyOnLoad (gameObject);
}

	public void CompleteLevel()
{
if (currentLevel < 3)  
{
currentLevel += 1;
Application.LoadLevel (currentLevel);
	} 
	else { 
				print ("You Won for now");
	}
			void OnGUI ()
	{
				GUI.skin = skin;
				if (startTime < 5f) 
		{
skin.GetStyle("Timer").normal.textColor =warningColorTimer;
		}else {
skin.GetStyle("Timer").normal.textColor =defualtColorTimer;
		}


GUI.Label (timerRect, currentTime, skin.GetStyle ("Timer"));
	}
}


This is not in C++, why are you posting this in a C++ website? Look likes Java or C# to me. I dont have enough context here but my guess it would have something to do with:

1
2
3
4
if (currentLevel < 3)  
{
currentLevel += 1;
Application.LoadLevel (currentLevel);
Oh shit my bad. I guess I wasnt thinking haha. Its C# . My bad.
Okay I will look in to that. thank you.
Registered users can post here. Sign in or register to post.