A top-down shooter built in C++ using SDL2, with multiple enemy types, weapon progression, pickups, levels, UI states, and sprite-based rendering.
- Top-down movement and shooting
- Multiple weapons (pistol, rifle, shotgun, machinegun)
- Enemy variety (horizontal, vertical, smart/chasing)
- Item pickups (health, speed boost, weapons)
- Inventory and weapon switching
- Level progression + game over flow
- Texture/sprite rendering for player, enemies, walls, floor, and items
- C++20
- SDL2
- SDL2_image
- SDL2_ttf
- CMake
SDL/— main game source codeSDL/sprites/— game assets (textures/sprites)SDL/build/— local build outputSDL/tests/— C++ test files (weapon, enemy, player, menu)
brew install cmake pkg-config sdl2 sdl2_image sdl2_ttfcd SDL
cmake -S . -B build
cmake --build build -jcd build
./fpscd SDL
cmake -S . -B build
cmake --build build -j4ctest --test-dir build --output-on-failurectest --test-dir build -R weapon_tests --output-on-failure
ctest --test-dir build -R enemy_tests --output-on-failure
ctest --test-dir build -R player_tests --output-on-failure
ctest --test-dir build -R menu_tests --output-on-failureweapon_tests— weapon stats, cooldown/reload, spread, level mappingenemy_tests— enemy movement/stats/difficulty/damage and score increment logicplayer_tests— player collision damage + invulnerability behaviormenu_tests— menu click action mapping + click debounce behavior
This repo includes a CI workflow at .github/workflows/ci.yml.
On every push and pull request, CI will:
- Install SDL2 dependencies on Ubuntu
- Configure with CMake (
cmake -S . -B build) - Build (
cmake --build build -j4) - Run tests (
ctest --test-dir build --output-on-failure)
To view results on GitHub:
- Open repository page
- Go to the Actions tab
- Open the latest CI run
W A S D— moveMouse Left Click— shootR— reloadSpace— meleeE— open/close inventory1 / 2 / 3 / 4— switch weapon (when unlocked)Esc— pause/unpause / back from some menusEnter— continue next level / restart from game overG— reset high score on game-over screen
- Add sound effects and music
- Add enemy hit feedback and damage popups
- Add save/load for progression
- Package releases for GitHub/itch.io
// console version (for testing game logic without graphics)
g++ -std=c++11 main.cpp -lncurses -o main
./main
