It is a simple version of game PacMan (1 lvl) with using WIN API. Here you can see short demo-video
The player controls the PacMan via arrows. The goal is to collect all treasure on game board, to avoid monsters, and ton die . The game would end when PacMan will collect all treasure and reach the exit, or when one of the monsters will touch PacMan.
- Download archive Release.rar.
- There ia exe-file, so you may receive the warning message from your browser or firewall. Ignore it =)
- Open the folder.
- Run PacMan.exe
Profit!
Game board is a table 19X20. Each box on the table has size BOXSIZE in pixel (look #define) Game board emplemented as two-demensional dynamic array. In the Array first demensional (i-loop) is COLUMNS on board, second demensional (j-loop) is LINES on board Board keeps all game objects (PacMan, ghosts), and has methods for drawing the PacMan, ghosts and treasure. Also there are methods for moving game object.
Board has public methods: StartGame, IsGameOn, NewLevelGenerate (for the future implementation), Draw - here called all Draw-method for all game objects, SetPacman - set new PacMan location after moving or teleportation from enter to exit and oposit, GetCurObject - return object type in specified position.
All game objects has parent class GameObject with common functionality: GeCurrentDirection, GetCurrentBox, SetNewDirection etc. And virtual funtions: StartInisialize and Draw.
PacMan is implemented as ObjectPacman with public methods: StartInitialize, Draw, SetNewDirection and Move.
Currently game has two same ghosts with same behavior - they are moving in random direction at all time. But we have two different classes for ghosts for future improvement their movement.
There are all common macroses: struct Point, struct PointTopLeft for boxes coordinate. Also there are difined values for colors in RGB-format, and enumeration Objects for code reading improvements. There also defined eenumeration for direction and for gamer status.