Skip to content

conglb/Flappy-Bird

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flappy Bird Game

A C++ implementation of the classic Flappy Bird game using SDL2.

Demo

Flappy Bird Gameplay Demo

Features

  • Classic Flappy Bird gameplay
  • Score tracking with high score persistence
  • Sound effects
  • Smooth animations
  • Collision detection

Prerequisites

macOS (with Homebrew)

brew install sdl2 sdl2_image sdl2_mixer

Ubuntu/Debian

sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev

Windows

  • Download SDL2 development libraries from https://www.libsdl.org/
  • Install SDL2_image and SDL2_mixer libraries
  • Configure your IDE to link against these libraries

Assets Required

Before running the game, you need to provide the following assets:

  1. img.png - A sprite sheet containing all game graphics
  2. sound/ directory with the following WAV files:
    • win.wav (scoring sound)
    • wing.wav (wing flap sound)
    • vacham.wav (collision sound)
    • roi.wav (falling sound)
    • die.wav (death sound)

See README_ASSETS.md for detailed information about the required assets.

Building

Using CMake (Recommended)

mkdir build
cmake -S . -B build
cmake --build build

Running

./FlappyBird

Controls

  • Space or Up Arrow: Make the bird flap
  • Escape: Quit the game

Gameplay

  1. Press Space to start the game
  2. Use Space or Up Arrow to make the bird flap and avoid pipes
  3. Try to get the highest score possible
  4. Click the restart button when the game ends

Project Structure

  • main.cpp - Main game loop and logic
  • Bird.h/cpp - Bird class implementation
  • Water_pipe.h/cpp - Pipe obstacle class
  • CommonFunc.h/cpp - Common utility functions
  • main.h - Main header file with includes

Technical Details

  • Built with C++11 and SDL2
  • Screen resolution: 288x512 pixels
  • Uses sprite-based graphics
  • Implements AABB collision detection
  • Supports audio through SDL_mixer

Troubleshooting

Build Issues

  • Ensure SDL2 development libraries are installed
  • Check that pkg-config can find SDL2 packages
  • Verify compiler supports C++11

Runtime Issues

  • Make sure img.png exists in the game directory
  • Ensure all sound files are present in the sound/ directory
  • Check that sound files are in WAV format

License

This project is for educational purposes. Please respect copyright when using game assets.

About

Flappy Bird game | C++ | SDL 2.0 | Assignment for Advanced Programming course

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published