A 2D survival game built with OpenGL and FreeGLUT where players control a white circle character, shoot projectiles at enemy rectangles, and survive in a dynamically resizing window environment.
Window Master is an arcade-style survival game featuring unique mechanics where the game window itself becomes part of the gameplay. Players must navigate, shoot, and survive while the window dynamically changes size based on their actions.
- Player Character: Control a white circle with a black center
- Enemy System: Red rotating rectangles that chase the player
- Projectile Combat: Shoot projectiles toward your mouse cursor
- Dynamic Window: Window size changes based on projectile impacts
- Health System: Enemies require 2 hits to destroy and change color when damaged
- Survival Gameplay: Avoid enemies and window boundaries to stay alive
- Use WASD keys to move your white circle character
- Movement speed: 3 pixels per frame
- Avoid touching enemy rectangles or window boundaries
- Left-click anywhere on the screen to shoot projectiles
- Projectiles travel from player position toward mouse cursor location
- Each projectile is a small white circle
- Enemies require 2 hits to destroy
- Red rectangles spawn from random edge positions
- Enemies continuously rotate and move toward the player
- When hit once, enemies turn yellow (1 health remaining)
- When destroyed, enemies may spawn 0-2 new enemies
- Each destroyed enemy gives 1 point
- Window expands by 25 pixels when projectiles hit right or bottom edges
- Window gradually contracts over time (1 pixel per frame)
- Window size changes create strategic gameplay elements
| Input | Action |
|---|---|
| W | Move Up |
| S | Move Down |
| A | Move Left |
| D | Move Right |
| Left Mouse Click | Shoot projectile toward cursor |
- +1 point for each enemy rectangle destroyed
- Score is displayed when the game ends
- Try to survive as long as possible for higher scores
The game ends when:
- Player collision: Your circle touches an enemy rectangle
- Boundary violation: Player moves outside the window boundaries
- A message box displays your final score
- OpenGL - Graphics rendering
- FreeGLUT - Window management and input handling
- C++ - Core programming language
- Code::Blocks - Development environment
- Windows operating system
- OpenGL-compatible graphics card
- FreeGLUT library installed
- C++ Compiler (MinGW/GCC recommended)
- FreeGLUT library
- OpenGL development headers
- Open
Window Master.cbpin Code::Blocks - Ensure FreeGLUT is properly linked in project settings
- Build the project (F9)
- Run the executable from
bin/Debug/Window Master.exe
g++ -o "Window Master" main.cpp -lfreeglut -lopengl32 -lglu32- Execute
Window Master.exefrom thebin/Debug/folder - Or run directly from Code::Blocks (Ctrl+F10)
- Stay Mobile: Keep moving to avoid enemy rectangles
- Use Window Dynamics: Shoot at edges strategically to expand your play area
- Target Damaged Enemies: Focus on yellow (damaged) enemies to clear them quickly
- Watch Boundaries: Be aware of the shrinking window size
- Control Enemy Spawns: Destroying enemies may spawn more, plan accordingly
tl2a: Projectile class handling movement and collisionRectangles: Enemy class with AI, health, and collision detection- Main Functions: Display, input handling, and game loop
- Collision Detection: Circle-rectangle collision using distance calculations
- Vector Math: Normalized direction vectors for movement
- OpenGL Rendering: Custom circle drawing and matrix transformations
- Game State: Real-time updates at 60 FPS using timer callbacks
- Add sound effects and background music
- Implement power-ups and special abilities
- Create multiple difficulty levels
- Add high score persistence
- Implement particle effects for explosions
This project is created for educational purposes as part of a Graphics Programming course.
This is an academic project. Feel free to fork and modify for your own learning purposes.
Developed as part of AAST Semester 5 Graphics Programming Course
