2d Space shooter Main Menu Problem

Started by
1 comment, last by SimonForsman 12 years, 1 month ago
[color=#111111][font=Helvetica, Arial, sans-serif]

so I've been doing this little project and following a tutorial on 3d buzz to make a top down shooter. Well all was going smooth I have finished most of the game until I had to make a main m[/font][color=#111111][font=Helvetica, Arial, sans-serif]

enu I have came across a problem with my code.[/font]








[color=#111111][font=Helvetica, Arial, sans-serif]

using UnityEngine;[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

using System.Collections;[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

public class MainMenu : MonoBehaviour[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

{ [/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

#region Fields[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

private string instructionText = "Instruction:\nPress Left and Right Awrrows to move.\nPress Spacebar to fire." [/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

private int buttonWidth = 200;[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

private int buttonHeight = 50;[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

#endregion[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

#region Properties[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

#endregion[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

#region Functions[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

void OnGui()[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

{[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

GUI.Label(new Rect(10, 10, 250, 200), instructionText);[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

if (GUI.Button(new Rect((Screen.width / 2) - (buttonWidth / 2), [/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

Screen.height / 2 - buttonHeight / 2, buttonWidth, buttonHeight), "Start Game")); [/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

{[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

Application.LoadLevel(1); [/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

}[/font]

[color=#111111][font=Helvetica, Arial, sans-serif]

} [/font]

[color=#111111][font=Helvetica, Arial, sans-serif]

#endregion[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

}[/font]

[color=#111111][font=Helvetica, Arial, sans-serif]

[/font]

[color=#111111][font=Helvetica, Arial, sans-serif]

I am getting an error in unity that says Assets/Scripts/MainMenu.cs(9,15): error CS1519: Unexpected symbol `private' in class, struct, or interface member declaration. [/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

private int buttonWidth = 200;[/font]
[color=#111111][font=Helvetica, Arial, sans-serif]

there is a red line under it but I cant seem to find out what is wrong. Hopefully someone who is awesome can. If you have any question or if I am leaving something out please let me know. [/font][color=#111111][font=Helvetica, Arial, sans-serif]

[/font][color=#111111][font=Helvetica, Arial, sans-serif]

cool.png[/font]

Advertisement
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour
{
#region Fields
private string instructionText = "Instruction:\nPress Left and Right Awrrows to move.\nPress Spacebar to fire."
private int buttonWidth = 200;
private int buttonHeight = 50;
#endregion
#region Properties
#endregion
#region Functions
void OnGui()
{
GUI.Label(new Rect(10, 10, 250, 200), instructionText);
if (GUI.Button(new Rect((Screen.width / 2) - (buttonWidth / 2),
Screen.height / 2 - buttonHeight / 2, buttonWidth, buttonHeight), "Start Game"));
{
Application.LoadLevel(1);
}

}

#endregion
}



sorry about what happen above and the double post but this is the code for my main menu.
add a semicolon at the end of the:
private string instructionText = "Instruction:\nPress Left and Right Awrrows to move.\nPress Spacebar to fire."


line.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

This topic is closed to new replies.

Advertisement