Let's bring the difficulty up a notch - both for the dog and the programmer! There are 3 new things happening in this version: We made a new DifficultyPicker
and we called it sizePicker
. Then, onRoundStart
(so each round), we use the DifficultyPicker to pick
a new size.
Hint: is the code too long? try switching from blocks mode to text mode.
Everything inside onRoundStart
will happen each time a new round starts - so all the set-up for a new round of the game should go here.
Try moving the moveto random position
line inside onRoundStart
- can you tell what changes in the way the game works?
DifficultyPicker
is magic! So hopefully it's worth the extra complexity. It will automatically pick a difficulty setting based on how well the dog did the previous round. You always need two parts to make a DifficultyPicker: the declaration, where you tell it the range of numbers to pick from, and the actual picking, which should usually be inside onRoundStart
, to pick a new difficulty level each round. In this example, sizePicker
will pick a turtle size between 20 (easiest) and 1 (hardest). The turtle size will use the difficulty setting because we used sizePicker.pick
to setSize
.
Scan this QR code with the Doggie And Me app to add the game to the app!
You can also view your program
Note: the QR code and the link will both expire after around 10 days