A feature-rich Flappy Bird clone built with WPF (.NET) using a clean 3-layer architecture. Developed as a group project for the PRN212 course.
- Classic Flappy Bird gameplay -- tap Space to flap, avoid pipes and obstacles
- Dynamic difficulty scaling -- speed increases, animated pipes appear, and new obstacle types spawn as your score climbs
- Day/Night cycle -- smooth theme transitions triggered by in-game gates or the N key
- 3 bird skins -- Yellow (Classic), Green, and Purple, each with unique fly/fall sprites for both themes
- Animated pipes -- oscillating, target-movement, and jump-pattern animations that intensify with score
- Group pipes (Staircase) -- clusters of 2-4 pipes arranged in ascending/descending staircase formations
- NoTouch obstacles -- bouncing hazards that spawn in increasing numbers after 10 pipes
- Gates -- collectible portals that toggle the day/night theme
- Persistent high score -- saved locally to file
- Background music and sound effects -- BGM with looping, jump/point/fail SFX
- Video background -- animated login screen with looping MP4
- Configurable pipe speed -- adjustable from 3 to 10 via Settings
The project follows a 3-layer architecture with clear separation of concerns:
FlappyBirdGame.sln
|
+-- PRN212.G5.FlappyBird/ # Presentation Layer (WPF)
| +-- LoginWindow.xaml/.cs # Login screen + BGM + video background
| +-- MainWindow.xaml/.cs # Core game window & game loop
| +-- SelectSkin.xaml/.cs # Bird skin selection UI
| +-- Views/
| | +-- SettingsWindow.xaml/.cs # Speed & volume settings
| +-- Helpers/
| | +-- AnimationHelper.cs # Day/night transitions, death animation
| | +-- AssetHelper.cs # Asset path & bitmap loading utilities
| | +-- BirdFrameManager.cs # Bird sprite frame management per skin/theme
| | +-- GameUIRenderer.cs # Creates & updates pipe/cloud/obstacle UI elements
| | +-- SoundHelper.cs # Sound effect playback
| +-- Assets/ # Images, audio, video resources
|
+-- FlappyBird.Business/ # Business Logic Layer
| +-- Models/
| | +-- BirdState.cs # Bird position, speed, rotation, animation state
| | +-- CloudState.cs # Cloud position and size
| | +-- GateState.cs # Gate position and activation status
| | +-- NoTouchState.cs # NoTouch obstacle position and oscillation
| | +-- PipePairState.cs # Pipe pair geometry, animation, and group info
| +-- Services/
| +-- BirdService.cs # Bird physics (gravity, jump, rotation)
| +-- GameService.cs # Score, high score, game state, grace period
| +-- StageService.cs # Pipe generation, difficulty scaling, obstacles
|
+-- FlappyBird.Data/ # Data Access Layer
+-- Repositories/
+-- GameRepo.cs # High score file persistence
- Bird physics -- gravity pulls the bird down each frame; Space key applies upward force
- Pipe movement -- all pipes scroll left at
baseSpeed + score * 0.1 - Pipe recycling -- when a pipe exits the left edge, it is repositioned to the right with new random properties
- Collision detection -- AABB (Axis-Aligned Bounding Box) checks against pipes, obstacles, ground, and ceiling
- Score -- incremented each time a pipe is recycled past the bird
| Score | Pipe Animation | Oscillation | Jump Pattern | Group Pipes | NoTouch |
|---|---|---|---|---|---|
| 0-9 | None | - | - | - | - |
| 10-14 | 50% chance | 50% | - | - | Phase spawning |
| 15-19 | 50% chance | 50% | - | 45% chance | Phase spawning |
| 20-29 | 65% chance | 65% | 30% | 45% chance | Phase spawning |
| 30-39 | 80% chance | 80% | 30% | 45% chance | Phase spawning |
| 40+ | 80% chance | 80% | 30% | 65% chance | Phase spawning |
| Parameter | Value |
|---|---|
| Canvas Height | 500px |
| Pipe Width | 80px |
| Gap between pipes | 180px |
| Pipe Spacing | 260px |
| Group Pipe Spacing | 90px |
| Gravity | 1.0 per frame |
| Jump Strength | -10.0 |
| Grace Period | 60 frames |
- .NET 6.0+ SDK (https://dotnet.microsoft.com/download)
- Windows OS (WPF requirement)
# Clone the repository
git clone <repo-url>
cd FlappyBird
# Build and run
dotnet run --project PRN212.G5.FlappyBird| Key | Action |
|---|---|
| Space | Flap / Jump |
| N | Toggle Day/Night |
| Replay Button | Restart after Game Over |
| Back Button | Return to Login screen |
| File | Purpose |
|---|---|
| birdfly-1/2/3.png | Bird fly sprites (3 skins) |
| birdfall-1/2/3.png | Bird fall sprites (3 skins) |
| Pipe-day/night.png | Pipe sprites for each theme |
| DayStage/NightStage.jpg | Background images |
| DayGround/NightGround.jpg | Ground images |
| Cloud-Day/Night.png | Cloud sprites |
| NoTouch.png | NoTouch obstacle sprite |
| BGM.mp3 | Background music |
| Jump/Point/Fail.mp3 | Sound effects |
| LoginWindowBG.mp4 | Login screen video background |