Middle School course

Programming 301

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

Answer Key

Module 2: Creating Power-Ups

Module 3: Invincibility Power-Up

Module 4: Survive the Waves

Module 5: Power Up

Module 6: Quiz

1. What does this code block do? {"func":"blockVarChangeBy","values":[{"type":"string","value":"health"},{"type":"number","value":"-10"}]}

  • It decreases the health variable by 10
  • It increases the health variable by 10
  • It sets the health variable to 10
  • It sets the health variable to -10

2. What does this code block do? {"func":"blockVarSet","values":[{"type":"string","value":"health"},{"type":"string","value":"10"}]}

  • It decreases the health variable by 10
  • It increases the health variable by 10
  • It sets the health variable to 10
  • It sets the health variable to -10

3. What does this code block do when we add it to the Stage? {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"invincibility"},{"type":"string","value":"0"}]}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"invincibility"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"invincibility"},{"type":"number","value":"-1"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}]}}

  • It acts as a timer by counting down the value of the invincibility variable
  • It increases the health of the dragon actor
  • It decreases the health of the dragon actor
  • It resets the health of all actors on the Stage

4. Which code block increases the dragon's health?

  • {"func":"blockVarChangeBy","values":[{"type":"string","value":"health"},{"type":"number","value":"1"}]}
  • {"func":"blockVarChangeBy","values":[{"type":"string","value":"health"},{"type":"number","value":"-1"}]}
  • {"func":"blockVarChangeBy","values":[{"type":"string","value":"health"},{"type":"number","value":"0"}]}
  • {"func":"blockVarSet","values":[{"type":"string","value":"health"},{"type":"string","value":"0"}]}

5. What happens if the value of the Wait block changes from 1 to 0.5? {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"invincibility"},{"type":"string","value":"0"}]}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"invincibility"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"invincibility"},{"type":"number","value":"-1"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}]}}

  • The invincibility power-up would last half as long
  • The invincibility power-up would last twice as long
  • The duration of the invincibility power-up wouldn’t change
  • The invincibility power-up would never end

6. What happens if the value of the Wait block changes from 1 to 2? {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"invincibility"},{"type":"string","value":"0"}]}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"invincibility"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"invincibility"},{"type":"number","value":"-1"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}]}}

  • The invincibility power-up would last half as long
  • The invincibility power-up would last twice as long
  • The duration of the invincibility power-up wouldn’t change
  • The invincibility power-up would never end

7. What would this code block do to an Actor? {"func":"registerFlagTrigger","next":{"func":"blockVarSet","values":[{"type":"string","value":"myVariable"},{"type":"string","value":"10"}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"myVariable"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"myVariable"},{"type":"number","value":"-1"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"0.5"}]}}],"next":{"func":"blockLooksHide"}}}}

  • Five seconds after the project is played, the Actor would hide
  • Ten seconds after the project is played, the Actor would hide
  • Twenty seconds after the project is played, the Actor would hide
  • One second after the project is played, the Actor would hide

8. What would this code block do to an Actor? {"func":"registerFlagTrigger","next":{"func":"blockVarSet","values":[{"type":"string","value":"myVariable"},{"type":"string","value":"10"}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"myVariable"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"myVariable"},{"type":"number","value":"-1"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}],"next":{"func":"blockLooksHide"}}}}

  • Five seconds after the project is played, the Actor would hide
  • Ten seconds after the project is played, the Actor would hide
  • Twenty seconds after the project is played, the Actor would hide
  • One second after the project is played, the Actor would hide

9. What would this code block do to an Actor? {"func":"registerFlagTrigger","next":{"func":"blockVarSet","values":[{"type":"string","value":"myVariable"},{"type":"string","value":"10"}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"myVariable"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"myVariable"},{"type":"number","value":"-1"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"2"}]}}],"next":{"func":"blockLooksHide"}}}}

  • Five seconds after the project is played, the Actor would hide
  • Ten seconds after the project is played, the Actor would hide
  • Twenty seconds after the project is played, the Actor would hide
  • One second after the project is played, the Actor would hide

10. Which code block is used to clear all graphic effects for an Actor?

  • {"func":"blockLooksClearEffects"}
  • {"func":"blockPenClear"}
  • {"func":"blockLooksSetEffect","values":[{"type":"choice","value":"color"},{"type":"number","value":"10"}]}
  • {"func":"blockLooksChangeEffect","values":[{"type":"choice","value":"color"},{"type":"number","value":"10"}]}

11. True or false: The resulting value for this variable will always be 10 after running this code block, regardless of the initial value. {"func":"blockVarSet","values":[{"type":"string","value":"health"},{"type":"string","value":"10"}]}

  • True
  • False

12. True or false: The resulting value for this variable will always be 10 after running this code block, regardless of the initial value. {"func":"blockVarChangeBy","values":[{"type":"string","value":"health"},{"type":"number","value":"10"}]}

  • True
  • False

13. True or false: Changing the ghost effect will make an Actor appear to fade away. {"func":"blockLooksChangeEffect","values":[{"type":"choice","value":"ghost"},{"type":"number","value":"10"}]}

  • True
  • False

14. True or false: Changing the color effect will make an Actor appear to fade away. {"func":"blockLooksChangeEffect","values":[{"type":"choice","value":"color"},{"type":"number","value":"10"}]}

  • True
  • False

15. True or false: To subtract a value from a variable, you should change it by a negative value. {"func":"blockVarChangeBy","values":[{"type":"string","value":"myVariable"},{"type":"number","value":"-1"}]}

  • True
  • False

U.S. Standards

  • CCSS-Math: 6.NS.C.6, MP.1, MP.7
  • 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-11, 2-AP-12, 2-AP-13, 2-AP-14, 2-AP-15, 2-AP-16, 2-AP-17
  • CS CA: 6-8.AP.11, 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 15: Powerups and Effects

Course: | Web

  • Concepts
  • Creating Power-Ups
  • Invincibility Power-Up
  • Survive the Waves
  • Power Up
  • 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.