Gardening Games

Worksheet and Game Assets

Worksheet (to download and print out)

The following ZIP archive contains:

  • Images for background (dry and raining), game actors (cow, flower, sick flower, fang flower, etc..
  • Sound effects for main events: flower generated, flower droping, fang generated, water poured.

Download this ZIP archive and copy contents in your coderdojo_tramore directory.

Session 1 (Saturday 27 June)

This game is a little longer than normal so plan is a bit loosey-goosey — we will just see how much of the worksheet we get done. (Then I will come back and edit this bit.)

OK, we got as far as step 30. We have implemented everythingm except the fangflower. The remaining steps should not take too long.

At end of this session, we got something like gardening_games_basic_session_1.py

Session 2 (Saturday 4 July)

Our starting point this week is last week's end point. If you were not here last week, then follow the download instructions for the game assets and then download gardening_games_basic_session_1.py to get started.

Plan this week is

  • Complete game — steps 31 to 36.
  • Review/clean code. The book does some nice things. For example, using _list to indicate lists is more obvious to programmers than my style of flower vs flowers. So I will probably use this in future. However the book does some crazy things. For example, two separate lists are used to store the flower information. One to store the actual flowers, flower_list and one to store the time they started to wlit wilted_list. The second list is not needed as the wilting information could be stored as part of the flower.
    For the fangflowers the situtation is similar, but now three lists are used.
    So the steps that we are going to do are (roughly)
    • Check identifiers (global variables, functions, local variables) — are they needed/used? does their name make sense?
    • Replace multiple lists for flowers.
    • Replace multiple lists for fangflowers.
    • Look at alternative variations of the velocity function.
    and bug fixing
    • Check our fix of the clock.schedule vs clock.schedule_unique.
    • Fix bug where the fangflower get stuck at the edge of the screen.
    and tweaking game
    • Currently a flower that is in contact with the code can instaneously switch to a fangflower and end the game. This is not great. We will add a test to ensure this does not occur.
    • Currently the game become impossible as the number of fangflowers increase. We need to add some feature to kill fangflowers. One possibility is to add rain, but there is a minimum time interval between rain events.