Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Problem with cheatcode

$
0
0
I am trying to make a script that when the player types "TILT" in sequency, the game changes to a new scene. BUT i am having a lot of problems, as usual T.T I found this script in the forum and i update it, but it doesn't work because of some problems. using UnityEngine; using System.Collections; public class eastereggscene : MonoBehaviour { private string[] cheatCode; private int index; void Start() { // Code is "tilt", user needs to input this in the right order cheatCode = new string[] { "t", "i", "l", "t" }; index = 0; } void Update() { // Check if any key is pressed if (Input.anyKeyDown) { // Check if the next key in the code is pressed if (Input.GetKeyDown(cheatCode[index])) { // Add 1 to index to check the next key in the code index++ { // Wrong key entered, we reset code typing else { index = 0; } } // If index reaches the length of the cheatCode string, // the entire code was correctly entered if (index == cheatCode.Length) } else { //load level Application.LoadLevel(1); } } The following errors appear: Assets/eastereggscene.cs(26.12): Error CS1525: Unexpected Symbol '{' Assets/eastereggscene.cs(37.12): Error CS1525: Unexpected Symbol '}' If i remove those keys, (i don't know if this is the correct name, english is not my mother language), i get these errors: Assets/eastereggscene.cs(28.16): Error CS1525: Unexpected Symbol 'else' Assets/eastereggscene.cs(38,16): Error CS1525: Unexpected Symbol 'else' What is wrong?

Viewing all articles
Browse latest Browse all 2891

Trending Articles