A 2D fish-eating game built with C++, the Win32 API, and GDI as an individual final project for the Programming Methodology course.
The player controls a fish in an underwater world, eating smaller fish to gain points and grow while avoiding or fighting larger enemies. The game contains five increasingly difficult levels, each with its own target score and enemy spawn settings.
| Item | Details |
|---|---|
| Course | Programming Methodology (程序设计基础) |
| Project type | Individual course project |
| Language | C++ |
| Graphics | Win32 API / GDI |
| Development environment | Visual Studio 2022 |
| Platform | Windows 10 / 11 |
| Completion year | 2026 |
| Status | Completed and archived |
| Start Menu | Character Selection | Gameplay |
|---|---|---|
![]() |
- Move the player fish around the scene.
- Eat smaller fish to gain points and gradually grow.
- Avoid larger enemies to prevent losing health.
- Colliding with a similarly sized fish damages and knocks back both sides.
- Reach the target score to complete the current level.
- Clear all five levels to finish the game.
| Action | Input |
|---|---|
| Move up | W or ↑ |
| Move down | S or ↓ |
| Move left | A or ← |
| Move right | D or → |
| Pause | Esc or Space |
| Menu interaction | Left mouse button |
- Two playable characters: a balanced red fish and a faster yellow fish.
- Five levels with different target scores and difficulty settings.
- Enemy AI with roaming, chasing, and fleeing behavior.
- Special gold, poison, and bomb fish effects.
- Speed, healing, shield, shrink, and star power-ups.
- Enemy swarms, hidden objectives, and extra-life rewards.
- A HUD for score, lives, size, health, and temporary effects.
- Particle effects, floating text, and multiple game sounds.
- Binary save and load support.
- Pause, game-over, victory, help, and character-selection screens.
A prebuilt executable is included for quick testing on Windows:
bin/FishGame.exe
The prebuilt executable is provided for convenience. Use Visual Studio to rebuild the project when reviewing or modifying the source code.
- Windows 10 or Windows 11
- Visual Studio 2022
- Desktop development with C++ workload
- MSVC v143 toolset
- Windows SDK 10.0
- Open
src/FishGame/FishGame.sln. - Select the
x64andDebugconfiguration. - Press
Ctrl+F5to build and run.
Run the following command in a terminal configured with the Visual Studio development environment:
msbuild src\FishGame\FishGame.sln /p:Configuration=Debug /p:Platform=x64Default output path:
src/FishGame/x64/Debug/FishGame.exe
The game is driven by the Win32 message loop:
wWinMain
└── WndProc
├── WM_CREATE -> initialize the game and resources
├── WM_TIMER -> update the game world
├── WM_PAINT -> render with GDI double buffering
├── keyboard input -> update input state
└── mouse input -> handle menu buttons
Key implementation details include:
- A fixed 30 ms timer updates units, items, collisions, and visual effects.
- Compatible GDI device contexts and an offscreen bitmap provide double-buffered rendering.
- Integer stage IDs control menus, gameplay levels, pause, victory, and game-over screens.
- BMP images are embedded in the executable through the Win32 resource system.
PlaySound()andmciSendString()provide sound effects and background music.- A binary
SaveDatastructure stores game progress.
See ARCHITECTURE.md for detailed information about the call flow, data structures, and object ownership.
.
├── bin/
│ └── FishGame.exe # Prebuilt executable
├── doc/
│ ├── 图片/ # Screenshots and flowcharts
│ ├── 设计文档.doc # Design document
│ └── 游戏介绍.pptx # Project presentation
├── src/FishGame/
│ ├── FishGame.cpp # Main implementation
│ ├── FishGame.h # Data structures and declarations
│ ├── FishGame.rc # Win32 resource script
│ ├── resource.h # Resource identifiers
│ ├── FishGame.sln # Visual Studio solution
│ ├── FishGame.vcxproj # Visual Studio project
│ ├── res/ # Bitmap and icon resources
│ └── audio/ # WAV audio resources
├── AGENTS.md # Codex project guidance
├── ARCHITECTURE.md # English architecture documentation (default)
├── ARCHITECTURE.zh-CN.md # Chinese architecture documentation
├── README.md # English documentation (default)
└── README.zh-CN.md # Chinese documentation
This is an individual course project. The overall design, feature integration, and debugging were completed by the author. AI-assisted tools were used for code writing and review, together with references to course material.
The course provided a reference template, but the final feature design and main implementation are largely independent of that template. No complete functions were copied directly from online sources or course examples.
This project is published primarily as an archive of course work, a learning resource, and a portfolio project.
Some images were generated with AI tools. The original sources and license information for some other images and audio files have not yet been fully verified. This repository currently has no open-source license and does not grant explicit permission to copy, modify, or redistribute its images, audio, or executable files.
If any asset raises a rights or attribution concern, please contact the maintainer through GitHub Issues.
The project was completed in 2026 and is now archived as a course deliverable and learning record. No ongoing feature development or major architectural rewrite is planned.

