Matthew Thibodeau
Matthew Thibodeau

Reputation: 161

Game Maker Array Not Initializing

I am trying to make a main menu using an array in Game Maker, and am using the following code to initialize it in the "Create" event. For the life of me I cannot figure out why it isn't working. I am getting the error:

Error at line 1 pos 5: Assignment operator expected.

So apparently the string variables are not assigning to the array indexes? Here is my code:

I am running Game Maker studio Professional Edition (v1.4.1567) if that helps.

menu[0] = "Start";
menu[1] = "Continue";
menu[2] = "Level Select";
menu[3] = "Options";
menu[4] = "Quit";

Upvotes: 1

Views: 711

Answers (1)

Magnus Ravn
Magnus Ravn

Reputation: 11

your code is completely correct. that means that the error must be in another event. if you don't already know, the error you are getting means that there is either:

no equals sign after a variable assignment

this_var;
// should be:
this_var = something;

or no brackets after a function

instance_destroy
//should be:
instance_destroy()

go through your code one more time and check for these errors.

Upvotes: 0

Related Questions