High School course

Programming 302

  • GRADES 7+
  • ADVANCED
  • WEB
  • 16 LESSONS
Slide: 1 of 26

Answer Key

Module 3: Multiple Shots

Module 4: Bomb Shot

Module 5: Space Bomb

Module 6: Bug Soccer

Module 7: Quiz

1. How can you check if the shotNumber variable is currently 2?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueVar","name":"shotNumber"},{"type":"string","value":"2"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueVar","name":"shotNumber"},{"type":"string","value":"2"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"shotNumber"},{"type":"string","value":"2"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueVar","name":"shotNumber"},{"type":"string","value":"2"}]}]}]}

2. What's the difference between the Repeat and Repeat While block? {"func":"blockControlRepeat","values":[{"type":"number","value":""}],"containers":[null]}{"func":"blockControlWhile","values":[{"type":"boolean","value":"true"}],"containers":[null]}

  • The Repeat block repeats a specified number of times, while the Repeat While block repeats based on a certain condition
  • The Repeat While block repeats a specified number of times, while the Repeat block repeats based on a certain condition
  • The Repeat While block repeats until the end of the program, while the Repeat block repeats based on a certain condition
  • There is no difference between the Repeat and the Repeat While blocks.

3. What's the difference between the Repeat While and Repeat Until blocks? {"func":"blockControlWhile","values":[{"type":"boolean","value":"true"}],"containers":[null]}{"func":"blockControlRepeatUntil","values":[{"type":"boolean","value":"false"}],"containers":[null]}

  • The Repeat While block runs as long as the specific condition is true. The Repeat Until block runs as long as the specified condition is false.
  • The Repeat While block runs as long as the specific condition is false. The Repeat Until block runs as long as the specified condition is true.
  • Both blocks do the same thing.
  • The Repeat While block repeats a specified number of times. The Repeat Until block repeats forever.

4. Which two code blocks do the same thing? (Choose 2.)

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[null]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockControlForeverIf","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueSensingMouseDown"}]}],"containers":[null]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockControlRepeatUntil","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueSensingMouseDown"}]}],"containers":[null]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[null]}}

5. What is the difference between these two code blocks? {"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[null]}{"func":"blockControlRepeatUntil","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[null]}

  • The Repeat While block will run until the mouse is no longer held down. The Repeat Until block will run until the mouse is held down.
  • The Repeat While block will run until the mouse is held down. The Repeat Until block will run until the mouse is no longer held down.
  • The Repeat While block will run until the mouse is no longer held down. The Repeat Until block will run forever.
  • The Repeat While block will run forever. The Repeat Until block will run until the mouse is no longer held down.

6. Which code block resets the shotNumber variable to 0 at the start of the program?

  • {"func":"registerFlagTrigger","next":{"func":"blockVarSet","values":[{"type":"string","value":"shotNumber"},{"type":"string","value":"0"}]}}
  • {"func":"registerFlagTrigger","next":{"func":"blockVarChangeBy","values":[{"type":"string","value":"shotNumber"},{"type":"number","value":"1"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockVarSet","values":[{"type":"string","value":"shotNumber"},{"type":"string","value":"0"}]}}
  • {"func":"registerCloned","next":{"func":"blockVarSet","values":[{"type":"string","value":"shotNumber"},{"type":"string","value":"0"}]}}

7. Which code block checks if the distance between the current Actor and the bottom edge of the screen is less than 100?

  • {"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"wrapper","func":"valueSensingScreenBottom"}]},{"type":"string","value":"100"}]}
  • {"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"wrapper","func":"valueSensingScreenBottom"}]},{"type":"string","value":"100"}]}
  • {"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"wrapper","func":"valueSensingScreenBottom"}]},{"type":"string","value":"2"}]}
  • {"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"wrapper","func":"valueSensingScreenBottom"}]}

8. Kyle is programming the orange alien as a target for his gravity sling. When the orange alien is hit by the asteroid, Kyle wants the alien to fall. Currently, the orange alien is active and static. What can Kyle add to the orange alien’s code to make it fall when the asteroid hits?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"asteroid"}]}],"next":{"func":"blockPhysicsSetStatic","values":[{"type":"boolean","value":"false"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"asteroid"}]}],"next":{"func":"blockPhysicsSetStatic","values":[{"type":"boolean","value":"true"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"asteroid"}]}],"next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"false"}]}}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"asteroid"}]}],"next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"true"}]}}

9. What does this code block do? {"func":"blockPhysicsApplyImpulse","values":[{"type":"wrapper","func":"valueOpMultiply","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"sling"}]},{"type":"number","value":"2"}]}]}

  • It applies an impulse to the Actor that is proportional to its distance from the sling. The farther away the Actor is, the stronger the impulse.
  • It applies an impulse to the Actor that is proportional to its distance from the sling. The closer the Actor is, the stronger the impulse.
  • It applies a fixed impulse to the Actor, regardless of the distance to the sling.
  • It applies an upward impulse to the Actor that is proportional to its distance from the sling. The Actor will always move upwards.

10. True or false: The value of this block increases the further away the Actor is from the sling. {"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"sling"}]}

  • True
  • False

11. True or false: You can apply multiple impulses to an Actor.

  • True
  • False

12. True or false: These two code blocks check for the same condition. {"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"sling"}]},{"type":"string","value":"100"}]}{"type":"wrapper","func":"valueOpGreater","values":[{"type":"string","value":"100"},{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"sling"}]}]}

  • True
  • False

13. True or false: These two code blocks check for the same condition. {"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"sling"}]},{"type":"string","value":"100"}]}{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"sling"}]},{"type":"string","value":"100"}]}

  • True
  • False

14. True or false: In this code block, the closer an Actor is to the sling, the stronger the impulse applied. {"func":"blockPhysicsApplyImpulse","values":[{"type":"wrapper","func":"valueOpMultiply","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"sling"}]},{"type":"number","value":"2"}]}]}

  • True
  • False

15. True or false: An active Actor is always non-static.

  • True
  • False

U.S. Standards

  • CCSS-Math: 6.NS.C, MP.1, MP.2, MP.4, MP.7
  • CCSS-ELA: 6-8.RST.3, 6-8.RST.4, 6-8.RST.7, RI.9-10.3, RI.11-12.3
  • CSTA: 2-AP-10, 2-AP-11, 2-AP-12, 2-AP-13, 2-AP-15, 2-AP-16, 2-AP-17, 3A-AP-17, 3A-AP-22
  • 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, 9-12.AP.12, 9-12.AP.16
  • 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 6: Explosions

Course: | Web

  • Introduction
  • Concepts
  • Multiple Shots
  • Bomb Shot
  • Space Bomb
  • Bug Soccer
  • Quiz

Description

In this advanced lesson plan, students will be introduced to the physics library as they build Gravity Sling, a projectile game inspired by Angry Birds (TM). They define the behaviors of different kinds of projectiles and use physics commands such as impulse, gravity and collisions to build the game. Ninja Runner is an advanced physics platformer game with a boss fight sequence that challenges them to apply all the concepts and skills they have learned.

Students who successfully complete this lesson plan will demonstrate excellent understanding of a variety of programming concepts and computational thinking skills, and will be able to design and implement projects of moderate to advanced complexity.

Topics

  • List variables
  • Structured data
  • Loops
  • Advanced flow control
  • Physics attributes
  • Velocity
  • Impulses
  • Collisions
  • Sending and receiving messages
  • Parameters
  • Functions
  • Advanced conditional logic
  • Math
  • Boolean operators

What Students Learn

  • Build a complete projectile-based physics game
  • Build a complete platformer game using physics
  • Programmatically generate never-ending platforms
  • Program a hero with multiple actions and access them via keys
  • Use cloud variables and a list data structure to implement a leaderboard
  • Use variables to keep score and game speed
  • Program enemy A.I.

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.