The Kodudes had had a week off (due to half-term) so I decided to let them jump straight back into their Kodu files to remind themelves of the end point of the last session.
In the last session I introduced the use of a variable to act as a 'key' for a locked doorway. So, this week we focused on this as a particular coding technique.
- In the context of the Monsters versus Aliens mini-game pupils grapsed how the variable could be used to unlock a locked gateway when 10 of the Galaxhar clones (Sputniks) had been zapped.
In the picture (left) the castle is blocking the doorway. For the mini-game we want the door to unlock after 10 Sputniks have been zapped.1. Adding a point to a score variable (A) when a Sputnik is zapped
Select the Master Sputnik and program it to add a score of ‘1 point’ when its health = zero…
Now, when a Sputnik is zapped, SCORE A will increase by 1 POINT.Now, when 10 Sputniks have been zapped (and SCORE A = 10) the CASTLE will VANISH (and the doorway is unblocked)
2. Make the castle disappear when SCORE A = 10 (when 10 Sputniks have been zapped)
Select the Castle object and program it to disappear when score A = 10 …
Having a plan of the game (visual and procedural) really helped pupils understand how variable score A sits as part of the mini game structure - we drafted our mini game on the whiteboard.