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 Lose (MonoBehaviour):
- public loseTexture as Texture
- private infoTxt as string = "You have lost! Do you want to retry?"
- def OnGUI ():
- GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), loseTexture)
- // Capture mouse click. If you click on button, takes to menu. Click anywhere else, takes back to game.
- if GUI.Button(Rect(10, 10, 150, 50), "Menu"):
- Application.LoadLevel(0)
- 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