Middle School course

Programming 301

  • GRADES 7-8
  • BEGINNER
  • WEB
  • 17 LESSONS
Slide: 1 of 20

Answer Key

Module 2: Hide the Ghost 1

Module 3: Hide The Ghost 2

Module 4: Defeat the Ghosts

Module 5: Wizard vs. Zombies Game

Module 6: Quiz

1. Which code blocks check when an Actor is on a Costume called "run 1"?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeName"},{"type":"string","value":"run 1"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"run 1"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeName"},{"type":"wrapper","func":"valueLooksCostumeName"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"wrapper","func":"valueLooksCostumeName"}]}]}

2. How can you check if an Actor is currently on one of the first 8 Costumes?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"9"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"8"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"8"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueLooksCostumeName"},{"type":"string","value":"9"}]}]}

3. Kyle is programming the ghost in his game. When the fireball hits the ghost, he wants the ghost to hide only if the ghost is on its first Costume. Which code blocks can help him do this?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"fireball"}]}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"1"}]}],"containers":[{"func":"blockLooksHide"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"fireball"}]}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeName"},{"type":"string","value":"1"}]}],"containers":[{"func":"blockLooksHide"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"fireball"}]}],"next":{"func":"blockLooksHide"}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"fireball"}]}],"next":{"func":"blockLooksNextCostume"}}

4. Wendy is looping through her Actor's Costumes. She wants her character's dancing Costumes to animate faster than the other Costumes. The Actor's dancing Costumes are the first 8. Which code blocks can help her do this?

  • {"func":"blockControlForever","containers":[{"func":"blockLooksNextCostume","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"8"}]}],"containers":[{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".5"}]}}}]}
  • {"func":"blockControlForever","containers":[{"func":"blockLooksNextCostume","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"9"}]}],"containers":[{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".5"}]}}}]}
  • {"func":"blockControlForever","containers":[{"func":"blockLooksNextCostume","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"9"}]}],"containers":[{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".5"}]}}}]}
  • {"func":"blockControlForever","containers":[{"func":"blockLooksNextCostume","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"9"}]}],"containers":[{"func":"blockControlWait","values":[{"type":"number","value":"0.5"}]}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"0.05"}]}}}]}

5. How can you pick a random Costume for an Actor with 10 Costumes each time the project is played?

  • {"func":"registerFlagTrigger","next":{"func":"blockLooksSwitchCostume","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"1"},{"type":"number","value":"10"}]}]}}
  • {"func":"registerFlagTrigger","next":{"func":"blockLooksSwitchCostume","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"1"},{"type":"number","value":"9"}]}]}}
  • {"func":"registerFlagTrigger","next":{"func":"blockLooksSwitchCostume","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"0"},{"type":"number","value":"10"}]}]}}
  • {"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"1"},{"type":"number","value":"10"}]}]}

6. How can you check if an Actor is on the bottom half of the screen?

  • {"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueMotionYPosition"},{"type":"string","value":"0"}]}
  • {"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueMotionYPosition"},{"type":"string","value":"600"}]}
  • {"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"string","value":"0"}]}
  • {"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueMotionYPosition"},{"type":"wrapper","func":"valueMotionXPosition"}]}

7. Wes is working on an animation project where a bird flies and lands on a tree. He wants the bird to stop flying and to sing a song when it reaches the tree. Which code blocks will help him program the bird?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"tree"}]}],"next":{"func":"blockLooksSwitchCostume","values":[{"type":"string","value":"perchedBird"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"bird song"}]}}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"perchedBird"}]}],"next":{"func":"blockMotionGoTowards","values":[{"type":"string","value":"tree"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"bird song"}]}}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"bird"}]}],"next":{"func":"blockLooksSwitchCostume","values":[{"type":"string","value":"perchedBird"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"bird song"}]}}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"bird"}]}],"next":{"func":"blockLooksSwitchCostume","values":[{"type":"string","value":"tree"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"bird song"}]}}}

8. Aubrey is working on a game where a bunch of Actors move around the screen pretty quickly. To beat the game, you have to "catch" them all by hovering your mouse over each Actor to make them disappear. What code can he use for the game's Actors?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"mouse-pointer"}]}],"next":{"func":"blockLooksHide"}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"mouse-pointer"}]}],"next":{"func":"blockLooksShow"}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"edge"}]}],"next":{"func":"blockLooksHide"}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"mouse-pointer"}]}],"next":{"func":"blockLooksNextCostume"}}

9. Matt is working on an obstacle game where the knight navigates through a maze, starting on the left edge of the Stage. He has placed a lot of Actors on the stage, and the player wins if they can reach the right edge. If the knight touches any of the obstacles, he has to go back to the starting position at (-500, 0). What code can he use for the knight?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"any"}]}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"right edge"}]}]}],"containers":[{"func":"blockMotionGoTo","values":[{"type":"number","value":"-500"},{"type":"number","value":"0"}]}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"left edge"}]}],"next":{"func":"blockMotionGoTo","values":[{"type":"number","value":"-500"},{"type":"number","value":"0"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"mouse-pointer"}]}],"next":{"func":"blockMotionGoTo","values":[{"type":"number","value":"-500"},{"type":"number","value":"0"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"any"}]}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"left edge"}]}]}],"containers":[{"func":"blockMotionGoTo","values":[{"type":"number","value":"-500"},{"type":"number","value":"0"}]}]}}

10. Dan is working on a catching game. Different balls fall down on the screen, and the player controls a catching mitt. Dan wants the mitt to catch the baseball. Which code blocks check to see if the mitt caught the baseball?

  • {"func":"registerTrigger","hiddenInSandbox":true,"values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"baseball"}]}]}
  • {"func":"registerTrigger","hiddenInSandbox":true,"values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"any"}]}]}
  • {"func":"registerTrigger","hiddenInSandbox":true,"values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"basketball"}]}]}
  • {"func":"registerTrigger","hiddenInSandbox":true,"values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"edge"}]}]}

11. True or false: {"type":"wrapper","func":"valueLooksCostumeNum"} and {"type":"wrapper","func":"valueLooksCostumeName"} can be used interchangeably.

  • True
  • False

12. True or false: You can change your Actor's Costume to the fourth Costume by using {"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksCostumeNum"},{"type":"string","value":"4"}]}

  • True
  • False

13. True or false: You can rename Costumes for an Actor by changing their names in the Costumes tab.

  • True
  • False

14. True or false: The When Event Occurs block can be used to check for when an Actor is on a specific Costume number. {"func":"registerTrigger","hiddenInSandbox":true,"values":[{"type":"boolean","value":""}]}

  • True
  • False

15. True or false: The When Event Occurs block can only be used to check if an Actor is touching anything. {"func":"registerTrigger","hiddenInSandbox":true,"values":[{"type":"boolean","value":""}]}

  • True
  • False

U.S. Standards

  • CCSS-Math: 6.NS.C.6, MP.1, MP.2
  • CCSS-ELA: RI.7.4, RI.8.4, 6-8.RST.3, 6-8.RST.4, 6-8.RST.7
  • CSTA: 2-AP-10, 2-AP-12, 2-AP-13, 2-AP-15, 2-AP-16, 2-AP-17
  • CS CA: 6-8.AP.12, 6-8.AP.13, 6-8.AP.15, 6-8.AP.16, 6-8.AP.17
  • ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b

U.K. Standards

Key stage 3
Pupils should be taught to:
  • design, use and evaluate computational abstractions that model the state and behaviour of real-world problems and physical systems
  • understand several key algorithms that reflect computational thinking [for example, ones for sorting and searching]; use logical reasoning to compare the utility of alternative algorithms for the same problem
  • undertake creative projects that involve selecting, using, and combining multiple applications, preferably across a range of devices, to achieve challenging goals, including collecting and analysing data and meeting the needs of known users
  • create, reuse, revise and repurpose digital artefacts for a given audience, with attention to trustworthiness, design and usability
  • understand a range of ways to use technology safely, respectfully, responsibly and securely, including protecting their online identity and privacy; recognise inappropriate content, contact and conduct, and know how to report concerns
Key stage 4
Pupils should be taught to:
  • develop their capability, creativity and knowledge in computer science, digital media and information technology
  • develop and apply their analytic, problem-solving, design, and computational thinking skills
  • understand how changes in technology affect safety, including new ways to protect their online privacy and identity, and how to report a range of concerns

Lesson 6: Show and Hide

Course: | Web

  • Concepts
  • Hide the Ghost 1
  • Hide The Ghost 2
  • Defeat the Ghosts
  • Wizard vs. Zombies Game
  • Quiz

Description

An advanced introduction to programming for middle school. Introduce programming fundamentals to your class as they build two arcade-inspired games from start to finish. The Adventure Game features a knight who has to defeat enemies to reach treasure. Students program arrow keys, fluid motion, hero and enemy behavior, and winning conditions. In Dragon Attack, they define multiple levels and lives, and program a boss enemy, while learning about variables and cloning.

Topics

  • Events
  • Keyboard and mouse interaction
  • Conditional loops
  • Nested loops
  • Sending and receiving messages
  • Fluid motion
  • Parallax scrolling
  • Local and global variables
  • Functions
  • Object cloning

What Students Learn

  • Build complex multi-level games
  • Use variables to keep score
  • Use cloning to create actors programmatically
  • Build algorithms using complex conditional logic
  • Understand parallelism with multiple scripts
  • Program different behaviors for different actors
  • Publish projects to the Web
  • Troubleshoot and debug programs

Technical Requirements

* Online courses require a modern desktop computer, laptop computer, Chromebook, or Netbook with Internet access and a Chrome (29+), Firefox (30+), Safari (7+), or Edge (20+) browser. No downloads required.