Skip to content

abdul-haseeb-dot/Airplane-Paths

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airplane Paths

A strategic two-player drawing game built with C++ and Raylib where players take turns drawing flight paths between terminals while avoiding collisions with existing paths.

image

Game Overview

Airplane Paths is a competitive drawing game that challenges players' strategic thinking and precision. Players alternate turns drawing continuous paths between airport terminals (represented as dots) on the screen. The objective is to successfully connect terminals while avoiding any contact with previously drawn paths. One wrong move results in an immediate loss!

Key Features

  • Two-Player Gameplay: Alternating turns between Player 1 (Blue) and Player 2 (Red)
  • Real-time Path Drawing: Smooth, continuous line drawing that follows mouse movement
  • Collision Detection: Instant game-over detection when paths intersect
  • Strategic Gameplay: Requires planning and spatial awareness to avoid existing paths
  • Clean Visual Interface: Simple, intuitive design with clear player indicators

How to Play

  1. Starting a Path: Click on any terminal (black dot) to begin drawing your flight path
  2. Drawing: Move your mouse to draw a continuous line from the starting terminal
  3. Completing a Path: Hover over another terminal to complete your path
  4. Winning: Successfully complete paths while your opponent crashes into existing lines
  5. Losing: Touch any part of a previously drawn path during your turn

Game Rules

  • Players must start and end their paths at terminals
  • Paths cannot intersect with any existing paths
  • The game ends immediately when a collision is detected
  • The player who causes a collision loses the game

Project Structure

AirplanePaths/
├── .gitignore                  # Git ignore rules for build files and OS artifacts
├── Makefile                    # Build configuration and compilation rules
├── README.md                   # Project documentation
├── headers/                    # Header files (.hpp)
│   ├── Constants.hpp           # Game constants and configuration values
│   ├── Dot.hpp                 # Terminal/dot structure and methods
│   ├── Path.hpp                # Path structure for flight routes
│   └── Utils.hpp               # Utility functions and helpers
├── main/                       # Main application files
│   └── Main.cpp                # Entry point and game loop
├── source/                     # Implementation files (.cpp)
│   ├── Dot.cpp                 # Terminal functionality implementation
│   ├── Path.cpp                # Path drawing and management
│   └── Utils.cpp               # Utility functions implementation
├── obj/                        # Compiled object files (created during build)
└── game/                       # Final executable output directory
    └── AirplanePaths.exe       # Compiled game executable

File Descriptions

Header Files (headers/)

  • Constants.hpp: Defines screen dimensions, colors, dot radius, and other game constants
  • Dot.hpp: Structure for terminal points with click detection and rendering methods
  • Path.hpp: Structure for flight paths including drawing states and player ownership
  • Utils.hpp: Utility functions for point generation and collision detection

Source Files (source/)

  • Dot.cpp: Implements terminal rendering, click detection, and hover detection
  • Path.cpp: Handles path creation, real-time drawing, and rendering
  • Utils.cpp: Point generation with spacing constraints and collision detection logic

Main Application (main/)

  • Main.cpp: Contains the game loop, event handling, UI rendering, and game state management

Installation & Setup

Prerequisites

  1. Install a C++ compiler (e.g., GCC or MinGW for Windows).
  2. Install Raylib (a simple and easy-to-use library for game development).
  3. Ensure you have a terminal or command prompt to run commands.

Building the Game

  1. Clone or download the project
  2. Navigate to project directory
  3. Run the following command to compile the game:
make all
  1. Or use this command to compile and run the game in one step:
make run

Cleaning Build Files

To remove compiled files and clean the project, run:

make clean

Technical Details

Dependencies

  • Raylib: Cross-platform game development library
  • C++17: Modern C++ standard for enhanced features and performance
  • Standard Library: Vector containers for dynamic path storage

Build System

  • Makefile: Automated compilation with dependency management
  • Object Files: Separate compilation for faster incremental builds
  • Static Linking: Self-contained executable with embedded libraries

Architecture

  • Modular Design: Separate classes for game entities (Dot, Path)
  • Global State Management: Centralized game state with extern variables
  • Event-Driven: Mouse input handling with real-time response
  • Memory Management: Dynamic allocation for active path creation

Future Improvements

Multiplayer Expansion

  • Multi-Player Support: Scale the game from 2 players to support 2-4 players simultaneously
  • Enhanced Color Coding: Additional distinct colors for 3rd and 4th players

User Interface Enhancements

  • Airplane Cursor: Replace the default mouse pointer with airplane images that rotate based on movement direction
  • Animated Terminals: Add pulsing or glowing effects to available terminals
  • Background Themes: Multiple visual themes including sky, night, or radar-style backgrounds

About

An original 2-player game developed in C++ with Raylib

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors