Play a game of asteroids from a file that uses only ONE script to generate everything… graphics, gameplay and sound!
OSG Asteroids is a game I made in 16 hours for the OSG Jam over at the GameMaker Community. “OSG” stands for “One Script Game”, and the whole game is a single script of about 1160 lines of code that is dropped into the Draw event of an object. Nothing more! All graphics and sounds are created as part of the script, and ONLY local scope variables and enums were permitted. This led to some interesting “hacks”…
Anyway, the game features:
- Gamepad/Keyboard Control
- Full menu screen, game over screen, and transition states
- Progressive gameplay levels
- Perpetuated high score from one run to the next
I recommend ALT+Enter to fullscreen it and play with a gamepad.
The game ZIP contains a .gml file with the entire source code! 1170 lines of code for you to peruse, learn from and edit or add to. The basic premise is that a data structure is made on the first loop of the game (along with particles, sounds etc…), and then after that a basic FSM takes over to control the game state. Most of it is commented so you can see which bit does what, but be warned that it’s not the most elegant of code! Have fun!