The primary goal of these projects is to build a simple Platformer game written in C++ using the raylib graphics library. In this game, the player navigates a character through a series of levels with platforms to traverse, collecting items, avoiding enemies, and solving puzzles.
The game should adhere to the best structured and procedural programming principles. You should strive to effectively utilize structured programming constructs such as selection constructs and loops. Additionally, endeavor to achieve procedural decomposition of your code into functions. Ensure consistent formatting in your code, adhering to coding style best practices, including proper naming, indentation, use of white spaces, blank lines, and comments.
Be creative, and ensure to implement the following essential elements in your project, as outlined below.
- Title or Menu Screen: The game should start with a title screen featuring a game logo and a message to start the game. Alternatively, it could be a menu screen with options to start the game, view the instructions, or quit the game.
- Game Screen: From the title or menu screen, the player should be able to start the game. The game screen displays the player's character, the level, and the items. Players move the character using the keyboard and collect items by moving over them. The goal is to move from one level to the next by passing through the level's exit. In our game, the objective of the player is to reach the end by passing through all the levels. There should be at least five levels in the game, though you can add more.
- Pause Screen: The player should be able to pause the game by pressing the Escape key. A 'Pause' screen appears with an option to resume the game. Pressing the Escape key again resumes the game.
- Victory Screen: Upon passing through all the levels, a victory screen displays a congratulatory message, allowing the player to return to the title screen. Some animation, possibly from lab class exercises, should play in the background to indicate the game's completion.
-
New Levels: Add at least four extra levels to the game. These levels should be more challenging than the one given. You can add more levels if you want.
-
New Game Elements: Introduce at least three new elements to the game. These could include new items, enemies, or obstacles. Be creative, but ensure one of these elements is an enemy.
-
Game Over Screen: Implement a 'Game Over' screen that displays a message when the player loses the game, such as when colliding with an enemy. This screen should allow the player to return to the title screen.
-
New Sounds: Add at least three new sounds to the game. These sounds could accompany actions like collecting an item, colliding with an enemy, or exiting the final level.
-
Music: Incorporate at least one music track into the game. This track should play on at least one of the screens. Ensure the track is royalty-free or that you have usage rights. Store the music files in the
data/musicdirectory and keep them reasonably sized. -
New Mechanics: Introduce at least one new gameplay mechanic. This could be a novel way to collect items, move the character, or interact with the level. Let your creativity guide you.
-
Develop the code independently and maintain a detailed project commit history. Be aware that points will be withheld for any suspicion of code plagiarism, even if it's unfounded. Additionally, consistent progress must be evident in your project commit history to receive any points at all.
-
Create a
Game.mdfile with a description of your game and a list of the features that you have implemented. Note that partially implementing some features is preferable to not implementing any. -
Ensure that the game is playable and contains all necessary files. It should be straightforward for the instructor to set up and start the game with minimal effort.
-
Develop the game within the
<repository>directory. This directory should include adatasubdirectory containing all game assets (images, fonts, sounds, etc.). Additionally, ensure the<repository>directory contains aGame.mdfile detailing your game and listing the implemented features. -
Organize your code into a set of header files. Each header file should contain related function definitions. Please, add forward declarations for each function in the
globals.hfile to prevent circular dependencies. -
Place your main game loop in the
platformer.cppfile, which should includeglobals.hand all other necessary header files.
Upon completion, your Project directory should have an organized structure similar to the following example:
.
└── <repository>
├── data
│ ├── fonts
│ │ └── ...
│ ├── images
│ │ └── ...
│ ├── music
│ │ └── ...
│ └── sounds
│ └── ...
├── platformer.cpp
├── globals.h
├── <various header files>.h
├── ... (.idea, .gitignore, CMakeLists.txt, other directories)
└── Readme.md
Commit and push your work at regular intervals, such as daily or after significant changes. Finally, submit the URL of the last commit to Moodle before the deadline.
Set up the raylib project as you have done in previous labs for graphics assignments.
Before attempting to run the code for the platformer target, please ensure that you set the Working directory correctly in your CLion IDE.
The current working directory must point to the directory containing the necessary resource files (e.g., data/images, data/fonts, and data/sound|music). Failure to do so will result in these resources not being loaded properly, and you will not see or hear the intended visuals or sounds in the game.
To set the working directory:
- Open the
Runmenu and find theEdit configurationsbutton there in CLion. - Select the
platformertarget. - Locate the
Working directoryfield. - Set it to the
$ProjectFileDir$value (this ensures it points to the root project directory with thedatafolder). - Save your configuration and run the target again.
If you encounter any issues, double-check that the paths to the resource files are correct relative to the working directory.
Refer to the specific course or assignment page on Moodle for detailed information about deadlines.
- Introduction to Programming with C++, 3rd Edition by Daniel Liang





