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?
 
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.
 
A

anomalous

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

FrostyCat

Member
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