This is my desktop implementation of the famous Flappy Bird
using the C++
language and SFML GUI library.
The main purpose of this project is to familiarize myself with the structures of a "quite" complex game. It also helps improving my knowledge in making a game/ app in general.
The game is designed based on the states machine model.
A finite-state machine (FSM) or finite-state automaton (FSA, plural: automata), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number of states at any given time. The FSM can change from one state to another in response to some external inputs and/or a condition is satisfied; the change from one state to another is called a transition.[1] An FSM is defined by a list of its states, its initial state, and the conditions for each transition.
Inputs (i.e. clicks) are handled by the InputManager
class.
All assets (i.e. textures and fonts) are handled using the AssetManager
class.
Every state transitions, add/ remove a state, active state are processed by the StateMachine
class (Different from State
class).
Game
object is created.- Setup a window - video mode.
- Move on to
Splash State
- Game
run()
- Show
Main Menu State
- Main game happens in
Game State
- If bird crashes, move to
GameOver State
- Back to
Game State
if replay is clicked.
class State {
public:
void init() { /* ... */ };
void handleInput() { /* ... */ };
void update() { /* ... */ };
void draw() { /* ... */ };
};
- The pipes are still quite far from each other.
- Pipe heights do not change much.
- The game consumes a high CPU power.