Middle School course

Programming 301

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

Answer Key

Module 2: Open the Gate

Module 3: Win Screen

Module 4: Add to the Adventure Game

Module 5: Build Your Own Adventure Game

Module 6: Quiz

1. Dan misspelled his message in his {"func":"registerBroadcastTrigger","values":[{"type":"string","value":""}]} block. Instead of "gate.open", he typed "gateopen". How will this affect his game?

  • The actor will never receive the message and the gate will not open
  • The actor will still receive the message
  • The actor never receives the message, but the gate will still open
  • The actor will send a message instead

2. Which of these blocks is NOT used for handling events?

  • {"func":"blockLooksNextCostume"}
  • {"func":"registerKeyTrigger","values":[{"type":"choice","value":""}]}
  • {"func":"registerTrigger","values":[{"type":"boolean","value":""}]}
  • {"func":"blockControlBroadcast","values":[{"type":"string","value":""}]}

3. Which block should you use if you want to send a message to a specific Actor?

  • {"func":"blockControlPostMessage","values":[{"type":"string","value":""},{"type":"string","value":""},{"type":"string","value":""}]}
  • {"func":"registerTrigger","values":[{"type":"boolean","value":""}]}
  • {"func":"registerBroadcastTrigger","values":[{"type":"string","value":""}]}
  • {"func":"blockControlBroadcast","values":[{"type":"string","value":""}]}

4. Which block should you use if you want to send a message to all of the Actors on the stage at once?

  • {"func":"blockControlBroadcast","values":[{"type":"string","value":""}]}
  • {"func":"registerBroadcastTrigger","values":[{"type":"string","value":""}]}
  • {"func":"registerTrigger","values":[{"type":"boolean","value":""}]}
  • {"func":"blockControlPostMessage","values":[{"type":"string","value":""},{"type":"string","value":""},{"type":"string","value":""}]}

5. Vanessa programmed one of her Actors to broadcast a message. Another one of her Actors, the knight, does not have a {"func":"registerBroadcastTrigger","values":[{"type":"string","value":""}]} block in his code. What will happen to the knight when the message is sent?

  • Nothing will happen
  • It will run the code blocks connected to the {"func":"registerBroadcastTrigger","values":[{"type":"string","value":""}]} block
  • It will send its own message
  • It will disappear from the stage

6. What's the difference between {"func":"blockControlPostMessage","values":[{"type":"string","value":""},{"type":"string","value":"any"},{"type":"string","value":""}]} and {"func":"blockControlBroadcast","values":[{"type":"string","value":""}]}?

  • While they both send messages, the 'Send Message' block sends it to one Actor in particular, and has the option of containing some kind of value to send using the 'with' field. The 'Broadcast' block is used to send a message to all Actors on the Stage.
  • Only the 'Send Message' block is used to send messages to Actors.
  • The 'Send Message' block is used to send messages to Actors, while the 'Broadcast' block is used to send messages only to the Stage.

7. True or false: You can name your messages whatever you want.

  • True
  • False

8. True or false: It is good practice to use meaningful or helpful names to identify what the message is used for.

  • True
  • False

9. True or false: You can have multiple When I Receive blocks for the same message.

  • True
  • False

10. True or false: An Actor can only receive one message.

  • True
  • False

11. True or false: Multiple Actors can receive the same message.

  • True
  • False

12. True or false: You can only use the Broadcast block once per project.

  • True
  • False

13. Cathy wants to program a radio and four of her Actors so that when she clicks on the radio, music will play and her four Actors will dance. Which group of code blocks will help her do that?

  • {"func":"registerSpriteTrigger","next":{"func":"blockSoundPlayUntilDone","values":[{"type":"string","value":"music"}],"next":{"func":"blockControlBroadcast","values":[{"type":"string","value":""dance""}]}}}
  • {"func":"registerBroadcastTrigger","values":[{"type":"string","value":""dance""}],"next":{"func":"blockSoundStopAll"}}
  • {"func":"registerKeyTrigger","values":[{"type":"choice","value":"up arrow"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"music"}]}}
  • {"func":"blockControlBroadcast","values":[{"type":"string","value":""music""}]}

14. What does this code block do? {"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockLooksNextCostume","next":{"func":"blockControlWait","values":[{"type":"number","value":".3"}],"next":{"func":"blockLooksSwitchCostume","values":[{"type":"string","value":"stand"}],"next":{"func":"blockControlForever","containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"run"}]}]}}}}}

  • When the right arrow is pressed, the Actor will change Costumes and the message will be sent repeatedly until the end of the program
  • When the right arrow is pressed, the Actor will change Costumes and the message will be sent once
  • When the right arrow is pressed, the Actor will change Costumes but the message will not be sent
  • When the right arrow is pressed, the Actor will not change Costumes, but the message will be sent ten times

15. What happens if we remove the broadcast block from this code block? {"func":"registerKeyTrigger","values":[{"type":"choice","value":"left arrow"}],"next":{"func":"blockLooksNextCostume","next":{"func":"blockControlWait","values":[{"type":"number","value":".3"}],"next":{"func":"blockLooksSwitchCostume","values":[{"type":"string","value":"blue button off"}],"next":{"func":"blockControlBroadcast","values":[{"type":"string","value":"jump"}]}}}}}

  • The message will not be broadcast, and the Actor will not jump
  • The message will be broadcast, and the Actor will jump
  • The message will not be broadcast, and the Actor will jump
  • The message will be broadcast, and the Actor will not jump

U.S. Standards

  • CCSS-Math: MP.1
  • 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
All pupils must have the opportunity to study aspects of information technology and computer science at sufficient depth to allow them to progress to higher levels of study or to a professional career. 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 9: Messaging

Course: | Web

  • Concepts
  • Open the Gate
  • Win Screen
  • Add to the Adventure Game
  • Build Your Own Adventure 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.