High School course

Programming 302

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

Answer Key

Module 2: Black Hole

Module 3: Add to the Gravity Sling Game

Module 4: Build Your Own Gravity Sling Game

Module 5: Quiz

1. Which of these blocks would you use if you did not want an Actor to be affected by gravity?

  • {"func":"blockPhysicsSetStatic","values":[{"type":"boolean","value":"true"}]}
  • {"func":"blockPhysicsSetGeometry","values":[{"type":"choice","value":"rectangular"}]}
  • {"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"true"}]}
  • {"func":"blockPhysicsApplyImpulse","values":[{"type":"number","value":"0"}]}

2. Which block would an Actor use to move to a specified point on the Stage?

  • {"func":"blockMotionGoTo","values":[{"type":"number","value":"0"},{"type":"number","value":"0"}]}
  • {"func":"blockMotionMove","values":[{"type":"number","value":"10"}]}
  • {"func":"blockMotionChangeXBy","values":[{"type":"number","value":"10"}]}
  • {"func":"blockMotionChangeYBy","values":[{"type":"number","value":"10"}]}

3. Which two code blocks would do the same thing to an Actor? (Choose 2.)

  • {"func":"blockMotionPointDirection","values":[{"type":"string","value":"90"}]}
  • {"func":"blockMotionPointDirection","values":[{"type":"string","value":"0"}],"next":{"func":"blockMotionTurnCW","values":[{"type":"string","value":"90"}]}}
  • {"func":"blockMotionPointDirection","values":[{"type":"string","value":"0"}],"next":{"func":"blockMotionTurnCW","values":[{"type":"string","value":"-90"}]}}
  • {"func":"blockMotionPointDirection","values":[{"type":"string","value":"0"}]}

4. Which of these blocks would turn the dragon from facing up to facing right?

  • {"func":"blockMotionTurnCW","values":[{"type":"string","value":"90"}]}
  • {"func":"blockMotionTurnCW","values":[{"type":"string","value":"180"}]}
  • {"func":"blockMotionTurnCCW","values":[{"type":"string","value":"90"}]}
  • {"func":"blockMotionTurnCCW","values":[{"type":"string","value":"180"}]}

5. Which code blocks are used to animate the black hole Actor to turn forever?

  • {"func":"registerFlagTrigger","next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"false"}],"next":{"func":"blockControlForever","containers":[{"func":"blockMotionTurnCCW","values":[{"type":"string","value":"5"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}}]}}}
  • {"func":"registerFlagTrigger","next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"false"}],"next":{"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[{"func":"blockMotionTurnCCW","values":[{"type":"string","value":"5"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}}]}}}
  • {"func":"registerFlagTrigger","next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"false"}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valuePhysicsIsActive"}],"containers":[{"func":"blockMotionTurnCCW","values":[{"type":"string","value":"5"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}}]}}}
  • {"func":"registerFlagTrigger","next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"false"}],"next":{"func":"blockControlRepeatUntil","values":[{"type":"wrapper","func":"valuePhysicsIsActive"}],"containers":[{"func":"blockMotionTurnCCW","values":[{"type":"string","value":"5"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}}]}}}

6. What does this code block do to an Actor? {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"string","value":"100"},{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"black hole"}]}]}],"next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"false"}],"next":{"func":"blockMotionGlide","values":[{"type":"number","value":"1"},{"type":"wrapper","func":"valueSensingSpriteProperty","values":[{"type":"choice","value":"x position"},{"type":"string","value":"black hole"}]},{"type":"wrapper","func":"valueSensingSpriteProperty","values":[{"type":"choice","value":"y position"},{"type":"string","value":"black hole"}]}]}}}

  • When the Actor gets close enough to the black hole, it will move towards it, making it look like it is getting sucked into the black hole.
  • When the Actor gets close enough to the black hole, it will start getting smaller, making it look like it is shrinking into the black hole.
  • When the Actor is far away from the black hole, it will move towards it, making it look like it is getting sucked into the black hole.
  • When the Actor is far away from the black hole, it will start getting smaller, making it look like it is shrinking into the black hole.

7. What does this code block do to an Actor? {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"string","value":"100"},{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"black hole"}]}]}],"next":{"func":"blockControlRepeat","values":[{"type":"number","value":"20"}],"containers":[{"func":"blockControlWait","values":[{"type":"number","value":".05"}],"next":{"func":"blockLooksChangeSizeBy","values":[{"type":"number","value":"-2"}]}}],"next":{"func":"blockLooksHide"}}}

  • When the Actor gets close enough to the black hole, it will move towards it, making it look like it is getting sucked into the black hole.
  • When the Actor gets close enough to the black hole, it will start getting smaller, making it look like it is shrinking into the black hole.
  • When the Actor is far away from the black hole, it will move towards it, making it look like it is getting sucked into the black hole.
  • When the Actor is far away from the black hole, it will start getting smaller, making it look like it is shrinking into the black hole.

8. Which of these code blocks checks if an Actor is within 100 units of the black hole actor?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"string","value":"100"},{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"black hole"}]}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"string","value":"100"},{"type":"wrapper","func":"valueSensingScreenLeft"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"black hole"}]},{"type":"string","value":"100"}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"black hole"}]},{"type":"wrapper","func":"valueMotionXPosition"}]}]}

9. Which of these code blocks checks if the current Actor is below the sci fi platform actor?

  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueMotionYPosition"},{"type":"wrapper","func":"valueSensingSpriteProperty","values":[{"type":"choice","value":"y position"},{"type":"string","value":"sci fi platform"}]}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"wrapper","func":"valueSensingSpriteProperty","values":[{"type":"choice","value":"x position"},{"type":"string","value":"sci fi platform"}]}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueMotionYPosition"},{"type":"wrapper","func":"valueSensingSpriteProperty","values":[{"type":"choice","value":"y position"},{"type":"string","value":"sci fi platform"}]}]}]}
  • {"func":"registerTrigger","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueMotionYPosition"},{"type":"wrapper","func":"valueMotionXPosition"}]}]}

10. What would these code blocks do to an Actor? {"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[{"func":"blockLooksChangeEffect","values":[{"type":"choice","value":"ghost"},{"type":"number","value":"10"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".05"}]}}],"next":{"func":"blockLooksHide"}}

  • The Actor would fade away
  • The Actor would change colors, then hide
  • The Actor would get smaller, then hide
  • The Actor would slowly turn into a ghost

11. True or false: If you want to have two Actors bounce off one another, they both need to be active.

  • True
  • False

12. True or false: By default, Actors are inactive and static when physics is turned on.

  • True
  • False

13. True or false: You can reset the graphic effects on an Actor using this block. {"func":"blockLooksClearEffects"}

  • True
  • False

14. True or false: You can reset the graphic effects on an Actor using this block. {"func":"blockPenClear"}

  • True
  • False

15. True or false: You can reset pen drawings on the Stage using this block. {"func":"blockLooksClearEffects"}

  • True
  • False

U.S. Standards

  • CCSS-Math: 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-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 8: Gravity Sling

Course: | Web

  • Introduction
  • Black Hole
  • Add to the Gravity Sling Game
  • Build Your Own Gravity Sling Game
  • 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.