• Advertisement

RyanSchurton

Member
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

100 Neutral

About RyanSchurton

  • Rank
    Newbie
  1. 2d Space shooter Main Menu Problem

    [code]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 } [/code] sorry about what happen above and the double post but this is the code for my main menu.
  2. 2d Space shooter Main Menu Problem

    [color=#111111][font=Helvetica, Arial, sans-serif][size=3]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[/size][/font][/color][color=#111111][font=Helvetica, Arial, sans-serif][size=3]enu I have came across a problem with my code.[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3][code]using UnityEngine;[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]using System.Collections;[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]public class MainMenu : MonoBehaviour[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]{ [/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]#region Fields[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]private string instructionText = "Instruction:\nPress Left and Right Awrrows to move.\nPress Spacebar to fire." [/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]private int buttonWidth = 200;[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]private int buttonHeight = 50;[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]#endregion[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]#region Properties[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]#endregion[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]#region Functions[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]void OnGui()[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]{[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3] GUI.Label(new Rect(10, 10, 250, 200), instructionText);[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3] if (GUI.Button(new Rect((Screen.width / 2) - (buttonWidth / 2), [/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3] Screen.height / 2 - buttonHeight / 2, buttonWidth, buttonHeight), "Start Game")); [/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3] {[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3] Application.LoadLevel(1); [/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3] }[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]} [/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]#endregion[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]}[/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3][/code][/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]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. [/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3][code]private int buttonWidth = 200;[/code][/size][/font][/color] [color=#111111][font=Helvetica, Arial, sans-serif][size=3]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. [/size][/font][/color][color=#111111][font=Helvetica, Arial, sans-serif][size=3] [/size][/font][/color][color=#111111][font=Helvetica, Arial, sans-serif][size=3][img]http://public.gamedev.net//public/style_emoticons/default/cool.png[/img][/size][/font][/color]
  • Advertisement