[Tutorial] Asteroids – imakeretrogames.com

Game Tutorial – Asteroids

Reposted from imakeretrogames.com

Goal

I cloned Asteroids in GameMaker Studio, to complete the Hexagons monthly challenge on OneGameAMonth. Graphics were made in Aseprite, sounds were pulled from OpenGameArt.

I heavily commented the source, so anyone who wants to learn some GML can follow along.

History

Asteroids was released by Atari in 1979. It was a massive hit for them. Game play is pretty simple. You pilot a small ship, which you fly around on a screen filled with asteroids. Shooting an asteroid causes it to break apart into a couple of smaller asteroids. That process happens twice. The final, tiny asteroids are destroyed when shot. Occasionally an alien saucer flies by and shoots at you.

Asteroids has a unique game fell. The style of movement is based on a lot of vector math. Coding it in ASM, like the original developers did was probably pretty difficult. Luckily, modern tools make that kind of thing trivial, so I leaned on GameMaker Studio to figure out the calculations for me, and just played with the numbers.

Details

Asteroids Gameplay
Asteroids Gameplay

I drew the sprites by hand with Aseprite. None of them (with the exception of the invincible ship sprite) are animated. I let GameMaker handle sprite rotation for me, rather than trying to animate it myself. Most of the code involved is stored as a GML script. There are a few places I used drag and drop, but mostly because I had a couple of one-offs that would’ve resulted several scripts which were one line long, and not reused anywhere else. In those cases I opted to just use DnD. I think that’s the only real, legitimate cast to use the DnD interface. I try to use it sparingly, because it is nowhere near as powerful as GML.

You can get the source here, and play a live demo here.

Leave a Reply

Your email address will not be published. Required fields are marked *