A 2D dodge and collect game built with C++ and SFML, featuring dynamic sprite animations and simple gameplay mechanics.
Collect as many coins as possible while avoiding falling rain and lightning bolts. You start with 5 hearts, and the challenge intensifies as the game progresses with decreasing spawn intervals!
- Movement: Use
Akey to move left,Dkey to move right - Goal: Collect coins (100 points each) while avoiding obstacles
- Health System:
- Start with 5 hearts
- Rain hits: -1 heart
- Lightning strikes: -3 hearts
- Restart: Press
Bafter game over to play again
- Architecture: Object-oriented design with sprite animation system
- Physics: Custom collision detection and entity management (AABB only)
- Sprites: Animated character sprites with frame-based animation
- SFML 2.x library
- C++ compiler (GCC/Clang)
- Make
-
Clone the repository:
git clone https://github.com/kingkururu/dodge_and_collect cd dodge_and_collect (location will be different) -
Build the game:
make
-
Run the game:
./run
-
Install SFML:
# Install Homebrew if not already installed /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install SFML brew install sfml@2
-
Configure PATH (add to ~/.zshrc or ~/.bash_profile):
export PATH="/opt/homebrew/bin:$PATH" export PATH="/opt/homebrew/opt/sfml@2/bin:$PATH"
dodge_and_collect_sfml_game/
├── assets/ # Game assets
├── game/ # Core logics
├── main # Entry point
├── .gitignore
├── ReadMe
└── Makefile # Build configuration
- Main player sprite: Free Pixel Art Tiny Hero Sprites
- Coin sprite: Golden Coin with Star Icon
- Lightning sprite: Free Animated Explosion Sprite Pack
- Lightning sound: Thunder Sound Effect
- Coin sound: Coin Collection Sound
- Raindrop sound: Rain Drop Sound
- Player dead sound: Game Over Sound
- Background music: 8-bit Gaming Music
- Arial font: Arial Font
- Game development fundamentals with SFML
- Object-oriented programming in C++
- 2D graphics rendering and sprite management
- Real-time input handling and game loops
- Collision detection algorithms
- Audio system integration
- Sprite animation and frame management


