GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - AndersonVanzo/zig-invaders: Space Invaders built with Zig

BranchesTags
Open more actions menu

Latest commit

 

History

20 Commits
20 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.zig
build.zig
 
 
build.zig.zon
build.zig.zon
 
 

Repository files navigation

Zig Invaders

A small Space Invaders clone written in Zig using raylib via raylib-zig.

Requirements

  • Zig 0.16.0 or newer

Dependencies are fetched automatically by the Zig package manager on first build.

Running

zig build run

To just build the executable (output lands in zig-out/bin/):

zig build

Run the tests:

zig build test

Controls

Key Action
← / A Move left
→ / D Move right
Space Shoot
Enter Start / restart the game
Esc Quit

Gameplay

Invaders march sideways, drop down a row when they reach a screen edge, and shoot back at random. Each invader you destroy is worth 10 points. Four shields sit above the player and absorb 10 hits each — from invader bullets and your own — fading out as they take damage.

You lose if an invader bullet hits you or the invaders reach your ship. You win by clearing the whole formation.

Project layout

src/
├── main.zig                       # window setup, game loop, state machine
├── root.zig                       # library root, re-exports the types below
├── config/game-config.zig         # GameConfig: all tunable values
├── primitives/rectangle.zig       # Rectangle + AABB intersection test
├── entities/
│   ├── player.zig
│   ├── invader.zig
│   └── shield.zig
└── projectiles/
    ├── player_bullet.zig
    └── invader_bullet.zig

Tweaking the game

Everything tunable — screen size, speeds, spacing, fire rates, grid dimensions — lives in the GameConfig literal at the top of main() in src/main.zig. The invader grid defaults to a small 1 × 2 formation; raise invader_rows and invader_columns for a real fight.

About

Space Invaders built with Zig

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.