image Computational Thinking: Collecting different types of objects in sequence with power-ups

How would you collect carrots first, and only after all the carrots have been collected will you be able to collect the bones?

We solve this by thinking about power-ups with Boolean attributes.

There are 10 carrots and 10 bones.
There is a rabbit controlled with mouse.
When the rabbit touches a carrot, the carrot disappears.
When all carrots are gone, the rabbit turns yellow.
When the yellow rabbit touches a bone, the bone disappears.
When all the bones are gone, you win.

Note that the rabbit will not be able to collect the bones until it has become yellow. It becomes yellow when all the carrots have been collected.


Experiment and try

How would you describe a game with 3 different types of objects that you need to collect in sequence?


Next page

Tutorials Home