Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

Formatting

A topic by JB created Mar 07, 2018 Views: 182 Replies: 5
Viewing posts 1 to 4
Submitted
var foo = 1, bar = 0;
if (foo)
{
    bar ++; foo = 0; 
}

Is stacking code on the same line allowed? Please expand on the code formatting section on the Jam page it's not very clear.

Submitted (1 edit)

Yes, please also answer to the question, whether we have to use brackets for one lining if statements.

Something like:

if(keyboard_check(ord("W")) then y-=2;

if(keyboard_check(ord("W"))
{
   y-=2;
}

Host

Declaring variables in one line is fine. Whenever you have to put a semicolon you have to make a new line. In Gamemaker you don't need to put semicolons but you SHOULD! Separate statements need to be on different lines. Comments also don't count as lines of code because the game isn't executing anything. Thanks for the question and sorry we were not clear on that earlier.

Submitted

What about "else" in if statements?

if (something) 

{

*something happens

} else {

?

}

Host

if (something) 

{

*something happens

}

 else 

{

?

}


You must make a line break for the brackets for the else

Submitted

Alright, Thanks!