Lesson 6

https://brainstormedu.com/wp-content/uploads/2020/10/TamaGatchaL6P1.png

Adding Additional Actions.


Right now, we can only perform one action with our Pet, which is to play. Inside of our elif statements, we are going to code the additional actions.

Now we are going to add on two additional actions. Since “Play” will restore our happiness, we will need actions to restore our other variables as well: Hunger, and Energy

The action we will use to replenish our Energy is “napping”. We will code this action under the first elif, on line 25

The code for this action we will be very similar to our “play” action, but this time, we want to restore energy, while losing hunger and happiness.

Copy the code from lines 25-28, as seen in the image to the side

Restoring Hunger.


We have one last action to code, the one that will replenish our pets Hunger

This code will go inside of the last elif statement, so start on line 30. Remember to indent accordingly

Copy the code from lines 30-32, as seen in the image to the side