posted this 09 November 2017
Start by creating a world with a Kodu, a tree, and a bunch of red apples. We'll program Kodu to collect all the apples and take them to the tree. I'll have Kodu change the color of the apples from red to green as he collects them so we can tell the difference
between the ones he has already collected and those he still needs to collect.
This is a good example for showing how Pages work in Kodu programming. In computer science we often talk about "states". You can think of a state as the "mode" that the character is in. For the Kodu we'll have 2 states. We'll have the state where he's
finding the next apple and the state where he has the apple iand is taking it to the trree.
Page 1 -- Finding the apple
1) WHEN See Apple Red DO Move Toward -- Look for the nearest red apple and move toward it.
2) WHEN Bumped Apple Red DO Grab -- When we bump the apple, grab it.
3) WHEN DO Switch Page2 -- After we've bumped the apple (and grabbed it) also switch to Page 2.
Page 2 -- Take the apple we're holding to the tree.
1) WHEN See Tree DO Move Toward -- Move toward the tree.
2) WHEN Got Apple Red DO Color It Green -- Change the color of the apple we're holding.
3) WHEN Bumped Tree DO Drop -- When we get to the tree, drop the apple and
4) WHEN DO Switch Page1 switch back to Page1.