Good formatting can take out a lot of hassle from game making. Good formatting can simply be described as a way to clean every thing up. When someone formats good, they make it easy to locate parts in their code or simply space it out so it is easy to read. The next few paragraphs are crucial to your game making success, read carefully.
Formatting consists of using comments, indents, and overall spacing it out.
No formatting ______________________________________________________________________________________________ if this > 0 and thistwo=1 { if prone=0 { instance_create(x,y,object1) this-1 andthis=0 alarm[0]=firingrate alarm[1]=2 } if prone=1 { instance_create(x,y+22,object1) this-1 andthis=0 alarm[0]=firingrate alarm[1]=2 } } ______________________________________________________________________________________________
The script above is an example of a shooting script. It is understandable but inefficient and is lacking commenting. What does alarm 0 and alarm 1 do? What does capable mean?
//Change stats and effects ammo -= 1; capable = false; //Can not fire
//Projectile interval alarm[0] = firingrate; } }
The Script appears much longer, but notice how you can pick out small details in it and can understand what each part does. You will notice a few things about the formatting.
Empty Lines Spaced Out Indents Closed statements Commenting
Other Good Practices Prefixes and/or suffixes are extremely useful while creating hundreds of objects and sprites.