• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Beginner, snake game odd code errors. Outdated tutorial?

H

HypSandar

Guest
This tutorial was made back in 2013..
Here's a link for it on a specific time stamp.


This is the first error, i clear it when i remove the ";" from line 12.

But, when i do that. Another one comes up without making sense.

It says that in line 13, at the location of letter "n" in the text: "instance_create" there is a missing symbol.
 
H

HypSandar

Guest
Is the tutorial outdated and Game Maker code changed over the past 3 years?
 
N

Nexusrex

Guest
First, change the ; into : (Not the ones in break)
(Gotta edit when i figure out the next one)
 
H

HypSandar

Guest
First, change the ; into : (Not the ones in break)
(Gotta edit when i figure out the next one)
Done, i didn't know ":" are used this way.. o_O
Here's the updated code:
Code:
if (currentID == 0) {
//Direction
//0 = right
//1 = left
//2 = up
//3 = down



switch(global.dir) {

case 0:
instance_create(x + 34, y, obj_snake):
break;
case 1:
instance_create(x + 34, y, obj_snake):
break;
case 2:
instance_create(x + 34, y, obj_snake):
break;
case 3:
instance_create(x + 34, y, obj_snake):
break;
// Cases are equal to = "if(global.dir = 0);"

}
}
Line 13 gets the same error.
 
N

Nexusrex

Guest
Oh, you did do another wrong thing (It's my fault). Remove the : after the instance_create or change them into ;
 
A

anomalous

Guest
no, just use : for the csae statement. Otherwise those lines should end in semicolon.
instance_create(x,y,obj); <--- not :
 

FrostyCat

Redemption Seeker
Only the semicolons you added to case should be changed into colons, the ones that come after instance_create() should remain as semicolons.

Also, did the tutorial really tell you to put a semicolon immediately after an if condition like that? That would clip it short and allow whatever that comes after it to run freely. No control structure should have a semicolon standing between it and the line/block of code that belongs to it.
 
Top