Dana Vrajitoru
I355/C490/B590 3D Games Programming

I355/C490/B590 Homework 10 Godot

Due Date: Wednesday, November 20, 2024.

In this homework we will continue Lab 10 to implement the game Monster Run. Here is an an example (http://www.cs.iusb.edu/~danav/teach/b583/monsterGL/) of the intended result.

In this game, the player advances on a path where it can find tiles containing either nothing special, or a treat (candy or pumpkin) or a monster. They must start from the starting position and will win the game when they reach the finish position. Here are the rules of the game:

The game can be summarized by the following finite state machine, where R = player's roll (the die_value in game_master), PU = player's powerup, MP = monster's power, store = stored powerup.

Ex. 1. Implement the functionality of the game by doing the following:

Here are some implementation suggestions:

Add attributes in game_master for the stored powerup, for the powerup to use in a fight, the score, the monster's power.

Add a function move_by that moves the player by a given number of tiles. This function would have to update the value of player_pos, confine the value to the boundaries of the tiles array, and then call place_player with the new position. Note that when moving, if the result should be a tile of a negative index, then you should place the player back at the starting position 0. Similarly, if the resulting tile number is larger than or equal to the size of the array of tiles, then you should place the player on the last position.

For bigger actions, it's probably better to define a separate function. For example, you could define two functions called move_action and fight_action to handle those actions. Then you can call them in the appropriate places from the action functions.

The fight_action function would roll the die and then decide whether the fight is won or lost. In case of a win, it would update the score with the difference between the player's hit (powerup plus die) and the monster's power. In case of a loss, it would have to move the player back by the amount of the difference.

The move_action function first moves the player by that number of places and then based on the type of tile it lands on, goes into another state: monster, powerup, or idle. The buttons and info are updated accordingly.

Ex. 3. (optional) Any additional features at your discretion for up to 3 extra credit points. For example, you could make the player move continuously from one tile to the next, or have the die actually spin before landing on the face it's supposed to.

Turn in to Canvas: a zip file with the script game_master.cs and a Windows build.