arrow_back Play Your Game with a Friend
Right now, only one player can play this game. In this screencast, you’ll remix this game so that a second player can control a chaser using keypress events. This screencast will demonstrate how to do that, then you’ll try it on your own.
First, select a chaser as the sprite for the second player. This sprite is going to do something different from the other chasers, so you need to rename it “player2.”
To do this, click on the property arrow above the sprite. Remember, computer scientists often work together on the same project, so it’s important to program in a way that is easy for other people to read and understand.
You programmed the chaser to bounce around the screen, but now you want it to stop moving on its own and be controlled by a second player. To make that possible, you first need to remove the code that moves this sprite. Don’t delete all of it – be sure to leave in place the if statement that checks if the two sprites are touching.
Next, you need to program events to move this sprite forward, backward, left, and right when a second player presses the arrow keys.
This screencast will fast-foward through the addition of these blocks, but when you create this code, remember that you need to add four events, four “motion” blocks and, if you want the sprite to turn smoothly, add a “repeat until not pressing” block for each event.
Once you finish coding all four events, tinker with the sprite’s speed by changing the value of the “move 10 steps” block. Play around with those values until player 2 moves slowly enough to make the game fair. Don’t worry if it takes a few tries to get this right. A big part of computer science is trying new things, testing them out, then going back to tinker with the code until you’re happy with the result.
Now, it’s your turn. Once you’ve finished programming your game for a second player, ask your neighbor to join the fun!