Dog and Crab is an example of one of the simplest games you can make and involves two sprites using broadcast messages to to interact with each other.
Press the green flag and use the mouse to get the dog to follow the crab and watch the crab run away. It is a two player game and the crab will respond to the arrow keys.
We have prepared a video that shows you how you can make this game or you can download and edit this game or use the following instructions to create it from Scratch. You can leave comments online on the Scratch website.
1. Import two sprites using the Choose new sprite from file button and select pictures from the animals folder. Change the sprite names to dog and crab.
2. Put a green flag control event on each sprite to set up the positions at the beginning of the game. Place the crab randomly on the stage at the beginning of the game as shown below.
2. Set the dog into the middle of the stage when the game begins and add a forever loop on the main control sprite to control movement. In this case the dog follows the mouse pointer.
3. Add a sensing component into the forever loop for the dog to work out when things happen. In this case do some stuff when the dog touches the crab but also broadcast something so the other sprites (or the stage) can also react.
5. Add a receive event onto the crab so it runs away when the dog touches it. Messaging between sprites is much easier to control than repeating sensing on each sprite.
6. Add a background and voila - c'est finis (it is finished).