-
The following comand should help you setup SFML Library which was used for rendering. I had Version: 2.5.1 (latest allowed for ubuntu), but hopefully should work on any newer version.
make setup
-
To compile all the files and create the executable
make
or
make compile
-
To run the game
./a.out
or you wanna look cool 😎
make run
-
This command was used by me to merge my png images together, to create the final textures.png, there is no immediate need to understand this.
make images
After executing the program, you'll see the player, blue blob move around. You can,
- Space Bar to pause
- Right Arrow to speed up
- Left Arrow to slowdown.
- Click the Close (X) Button on the window → closes the window and exits the game, and displays your score.
If the game is completed, the game is automatially paused.
Run the game for a while, and you can see the blob is in it's starting position and not moving.
- The blob guys is supposed to explore the maze, encoded in
Player.think() - There are 4 type of tiles, as in the blobs memory
| Color Name | Color | Number in memory | Meaning |
|---|---|---|---|
| Black | 0 |
Uexplored tile | |
| Dark Gray | 1 |
Visited Path | |
| Light Gray | 2 |
Wall | |
| Yellow | 3 |
Goal |
- The blob has a 3X3 vision* around it. It moves according to the function
Player.think(), at the start. - Once it steps onto the Goal Tile it finds the shortest route (according to it's memory) to the starting point and goes, as per
Player.gotoTarget(0,0). (This is how shortest path is calculated of your run)
script.cpp is the only file I would like you to modify. It has a child class of player, for you to implement and play with,
(Due to impatience), bothPlayer.gotoTarget()andPlayer.Think()are very horriblly implemented- So they have been declared as
virtualfunctions (you'll learn more about the later), for you to override in the child class. - Learn some nice maze solving algorithms, and implement them in the Think() member function.
- You may have multiple paths to the goal
- Even after you discover the goal, the
gotoTarget(0,0), activates once you step on it, so you can still explore for other routes.