This week in CoderDojo Athenry, we continued to play with networking in Scratch.
As we learned last week, you can set up a Mesh network in Scratch so that Scratch programs running on two different computers can exchange information with each other. This week, we used those ideas in combination with our simple guessing game from Challenge 2, to create a 2-player network guessing game.
Since we have new members who have just joined us in the past week, they could focus on the one-player version while more experienced members could work on the networking aspect.
The big ideas behind this challenge were:
- Design of a 2-player game (need two programs with different roles and different code)
- Communications on the network using variables
- Broadcasts across the network
- Loops and Decisions: fundamental coding concepts
Here are my notes from the day (PDF format): CDA-S2-Challenge12-2Player-GuessingGame.pdf
Here are my versions of the game for both players:
- GuessNumberNetwork: this is the one that plays the ‘guess a number game’ when the other one (the ‘boss’) chooses the number
- GuessNumberNetwork-Boss: this is the one that allows you choose the number and then communicates with the other one that plays
Note that you must download these (they won’t run on the Scratch website) and enable Mesh networking as described in the notes for them to work.
If you would like a copy of my slides in PowerPoint format, get in touch via Twitter or the comments.