Card matching game (90205)

I am following a tutorial that creates a card matching game using a GUI. I have gone through the code several times and did a google search for as to why I keep getting these errors but haven’t been able to find anything to help.

This is the code that gives me the first error.

var cardW : int  100; // Each card's width and height is 100 pixels
var cardH : int  100;

This is the error I am getting

Assets/Scripts/GameScript.js(8,16): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Scripts/GameScript.js(9,16): UCE0001: ‘;’ expected. Insert a semicolon at the end.

I can’t make sense of this as I have semi colons at the end of both lines.

This is the second part of code that is giving me an error

function OnGUI ();

This is the error
Assets/Scripts/GameScript.js(32,10): BCE0044: expecting (, found ‘OnGUI’

For some reason a previous error I had was calling for a semi colon at the end of this line so I added it and it removed the error.

Any help would be greatly appreciated!

Show the whole code and I'll take a look. That semicolon isn't supposed to be after the GUI function. That's for sure. It would be helpful to see the full code though.

–

1 Answer

1

On your first two lines you are missing an equal sign. They should be:

var cardW : int  = 100; // Each card's width and height is 100 pixels
var cardH : int  = 100;

Or you can have the compiler just infer the type:

var cardW = 100; // Each card's width and height is 100 pixels
var cardH = 100;

As @jesser1981 mentioned, the ‘;’ on the OnGUI is wrong. It should be:

function OnGUI() {

// Your GUI code goes here

}