Space Combat Game (SFML + C++)
A 2D Space Shooting Game built with C++ and SFML
Space Combat is a real-time 2D arcade-style space shooter where the player controls a spaceship, shoots incoming enemies, dodges enemy fire, and progresses through increasingly challenging levels. This project demonstrates core game development fundamentals using C++ and SFML, including game loops, collision detection, state management, and rendering.
◼️ Gameplay Features
• Player-controlled spaceship with smooth movement
• Bullet shooting system (player & enemies)
• Enemy spawning with increasing difficulty
• Enemy health bars
• Score, lives, and level system
• Temporary invincibility after taking damage
• Menu, gameplay, and game-over states
• Simple HUD (score, lives, level)
• Cross-platform font loading (Linux / Windows)
◼️ Controls
• Key Action
• Arrow Keys - Move player
• Space - Shoot/Start game
• R - Restart after Game Over
• Esc - Exit game
◼️ Project Structure (Key Components)
• Bullet and Enemy structs
• Game state management (MENU, PLAYING, GAME_OVER)
Separate logic for:
• Input handling
• Enemy spawning
• Shooting mechanics
• Collision detection
• Rendering & HUD updates
◼️ Technical Highlights
• C++17
• SFML (Graphics, Window, System)
• Object-oriented design using structs
• Delta-time based movement
Collision detection:
•Bounding box checks
• Distance-based collision
• Efficient game loop with frame limiting
◼️ Built With
• Language: C++
• Library: SFML (Simple and Fast Multimedia Library)
• Platform: Linux / Windows
◼️ Installation & Run
• Linux
sudo apt install libsfml-dev
g++ main.cpp -o space_combat -lsfml-graphics -lsfml-window -lsfml-system ./space_combat
• Windows
-
Install SFML
-
Configure include & lib paths
-
Compile using MinGW or Visual Studio
-
Run the executable


