Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Peek-a-boo

Choose an Add-On
play_circle_filled
Rearranging Furniture
Customize the look of each location.
arrow_forward
play_circle_filled
Peek-a-boo
Make the game more challenging by showing the object only if the character is nearby.
arrow_forward
play_circle_filled
Code a Conclusion
Add some slides to end the story when the player wins.
arrow_forward
play_circle_filled
Musical Objects
Add some interactive items that make sound when the character walks over them
arrow_forward
play_circle_filled
Obstacle Obstruction
Make the maps more realistic by preventing the character from running into obstacles, like trees or buildings.
arrow_forward
play_circle_filled
Hide and Seek
Hide the object in a random location each time.
arrow_forward
  • 1. Activity 7 Survey
  • 2. Introduction to the Quest Game
  • 3. Places to Go
  • 4. Add an Exit
  • 5. Hide the Object
  • 6. Add Storytelling Elements
  • 7. Add-Ons
  • 8. Reflection
  • 9. Wrap-up: Quest Game
  • 10. Wrap-up: Share Your Project
  • 11. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

In this add-on, you’ll make the object appear only when the character is close to it. This makes the game much more challenging! Click the flag, and move the character sprite to the location where the object is hidden. Then, select the object sprite. Open the “sensing” menu, and drag out a “distance to” block. Select the main character sprite from the dropdown, then click on the block. The block displays a number. This number represents the distance between the object and the character. Move the character closer to the object, and click the block. The distance value got smaller. Move the character away from the object, and click the block again. The distance value is larger.

Use a conditional to program the object to appear if its distance to the character is less than a certain number, and disappear otherwise. Open the “control” menu, and place an “if else” block inside the “forever” loop. Then, place a “less than” operator into the condition field. Put the “distance to” block on the left side, and type a distance on the right. This example will use a distance of 100.

Open the “looks” menu. Place a “show” block in the “if” portion, and a “hide” block in the “else” portion. Test this code by moving the sprite closer and further from the object. Nice! Now the player will need to search each location in order to find the object! Now, it’s your turn!

Make the object appear only if it’s close to the sprite using a “distance to” block, a “less than” operator, and “show,” “hide,” and “if else” blocks.