Skip to content

AtharvaThorve/Flappy-Bird-in-Paint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flappy Bird in Paint

This project is a C++ implementation of the Flappy Bird game, but instead of using a traditional game engine, it uses Microsoft Paint to draw the game elements. The game simulates mouse and keyboard inputs to control the drawing and gameplay. The inspiration for the project was from this youtube video

Table of Contents

Introduction

Paint Flappy Bird is a unique take on the classic Flappy Bird game. It uses C++ to simulate mouse and keyboard inputs to draw the game elements in Microsoft Paint. The game features a pentagon representing the bird and pipes that the bird must navigate through.

Gameplay

Gameplay

Features

  • Simulates mouse and keyboard inputs to draw in Microsoft Paint
  • Flappy Bird gameplay with a pentagon as the bird
  • Randomly generated pipe gaps
  • Collision detection between the bird and pipes
  • Score tracking

Requirements

  • Windows operating system
  • Microsoft Paint
  • MinGW-w64 (for cross-compiling)
  • C++17 or later

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/paint-flappy-bird.git
    cd paint-flappy-bird
  2. Install MinGW-w64:

    • Download and install MinGW-w64 from here.
  3. Build the project:

    make

Usage

  1. Open Microsoft Paint and ensure it is the active window.

  2. Run the executable:

    ./main.exe
  3. Use the following controls to play the game:

    • SPACE: Flap the bird
    • RIGHT SHIFT: Start/stop drawing
    • ESC: Quit the game
  4. Screen resolution and canvas size:

    • Screen Resolution: 1980 x 1080
    • Canvas Size: 1435 x 723
    • Zoom: 100%

Code Overview

Main Components

  • main.cpp: Contains the main game loop and handles user input.
  • utils.cpp: Contains utility functions for simulating mouse and keyboard inputs, drawing lines, and collision detection.
  • init.cpp: Contains the initialization function to set up the drawing environment in Microsoft Paint.

Headers

  • main.hpp: Declares the main functions and global variables.
  • utils.hpp: Declares utility functions.
  • init.hpp: Declares the initialization function.

Makefile

The Makefile is used to build the project. It specifies the compiler, compiler flags, source files, and build targets.

Functions

  • moveMouseTo(int x, int y): Moves the mouse cursor to the specified coordinates.
  • leftMouseClick(): Simulates a left mouse click.
  • pressKey(char key): Simulates a key press.
  • drawLine(int startX, int startY, int endX, int endY, int steps): Draws a line in Paint.
  • simulateCtrlZ(): Simulates a Ctrl+Z (undo) action.
  • performCtrlZ(int times): Performs multiple undo actions.
  • drawPentagon(int centerX, int centerY, int sideLength): Draws a pentagon representing the bird.
  • drawPipe(int x, int gapY, int gapHeight): Draws a pipe with a gap.
  • checkCollision(int pentagonX, int pentagonY, int pentagonSize, int pipeX, int gapY, int gapHeight): Checks for collisions between the bird and pipes.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

It is what it sounds like. Flappy Bird game in MS Paint.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published