My implementation of
Space Invaders
in zig using raylib and an ECS.
I'm working on this game as part of The 20 Games Challange. Space Invaders is Challange #3.
- Create a player ship that moves side to side.
- Create a few different types of alien invaders.
- Enemies will move together in a grid. They cross the screen horizontally before dropping vertically and reversing their direction.
- Add the ability for the player ship to fire rockets that travel up the screen.
- Add bombs/bullets that the enemies drop. The player’s rockets can destroy enemy bullets.
- Make sure that the player’s bullets will destroy invaders, and the invader bullets will destroy the player.
- Add a mothership that will cross the screen periodically. Destroying it will result in bonus points.
- Add a UI that tracks the player score and lives left. The player starts with three lives.
Head over to itch.io to play the game in your browser.
zig build run
zig build -Dtarget=wasm32-emscripten
Key | Description |
---|---|
H , Arrow Left |
Move left |
L , Arrow Right |
Move right |
Space |
Shoot |
Enter |
Start/pause/resume |
F1 |
Toggle debug mode |
F2 |
Toggle sounds/music |
Q , Escape |
Quit game |
List of all assets used in this game:
File | Source/Author |
---|---|
assets/soundtrack.wav |
stefanpartheym in Ardour with OB-Xd |
assets/explosion.wav |
stefanpartheym in Ardour with Surge XT |
assets/explosion-short.wav |
stefanpartheym in Ardour with Surge XT |
assets/impact.wav |
stefanpartheym in Ardour with Surge XT |
assets/win.wav |
stefanpartheym in Ardour with Surge XT |
assets/loose.wav |
stefanpartheym in Ardour with Surge XT |
assets/gameover.wav |
stefanpartheym in Ardour with Surge XT |
assets/player.png |
stefanpartheym in GIMP |
assets/invaders.png |
Alfalfamire on OpenGameArt.org |
assets/explosion.png |
Sogomn on OpenGameArt.org |