Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This script is licensed under the BSD license.
- Author: Cody Dostal
- Author Email: allysman21@gmail.com
- Date Written: 4/22/2012
- Date Last Edited: 4/24/2012
- Engine Version: 3.5.1f2
- Script Version: v1.1
- */
- /* NOTE: With good chance, you may have to change any hard-coded values in these scripts.
- These values work with my version, and may not with your version. */
- import UnityEngine
- class mainMenu (MonoBehaviour):
- public startTexture as Texture
- private buttonWidth as int = 200
- private buttonHeight as int = 50
- def OnGUI ():
- GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), startTexture)
- // Capture mouse click. If you click on button, takes to menu. Click anywhere else, takes to game.
- if GUI.Button(Rect(10, 10, 150, 50), "Instructions"):
- Application.LoadLevel(4)
- elif Event.current != null and Event.current.isMouse:
- resetAndLoad()
- // If any key EXCEPT the left mouse button is clicked, call resetAndLoad()
- if Input.anyKeyDown and not Input.GetMouseButtonDown(0):
- resetAndLoad()
- def resetAndLoad():
- // Reset all things related to player.
- player.score = 0
- player.lives = 3
- player.missed = 0
- // Load the game again, skip menu.
- Application.LoadLevel(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement