Shooting & Disappearing Objects
Purpose: Students will create a program in which they will shoot moving objects.
View Model: "Mobile" (You Tube) (Wizard & Dragon)
Gradesheet
- Program #1: Moving the Dragon & Wizard with Directional Arrows.
- The Wizard: In the last lesson, you moved a Tank using Directional Keys. Refer to the code you wrote in the Tank lesson to make the Wizard slide side to side by pressing the arrows on the keyboard.
- Here is a new line of code that you know, but have not learned. For the Wizard's motion, place two "If/Then" commands in a "Forever" loop. "If key right/left pressed, Then Move 10/-10 steps". Try it!
- The Dragon: Make the dragon move constantly from side to side. You may want to take a look at the Trump/Hillary Race program you wrote. In a "Forever" loop, use a "Glide" and a "Turn 180 degrees." Note: Place "Point In Direction" after the "Green Flag." This will help keep the dragon facing in the correct direction while it is moving.
- Note: The Green Flag starts the game.
- Program #2: The Wizard Shoots a Lightning Bolt.
- Write a program that allows the Wizard (while moving) to fire a lightning bolt (by clicking on the space bar) toward the constantly moving dragon. I am going to provide you with the new code below…you need to determine how the program is organized.
Note: In order to get the lightning bolt to line up with the Wizards arm, I had to adjust it in the costume screen.
- Program #3: The Lightening Bolt Should Disappear When It Hits The Dragon.
- When the Lightening Bolt hits the Dragon, the lightning bolt should disappear. If it misses, it will procede off the screen and disappear.
Hint: Take a look at your Princess code when the Princess touches the Unicorn to see how the bolt will know when to disappear. Then look at the code shown below and add it to the program you just wrote that allows the bolt to move.
- Program #4: Add a Point Counter
- Add a counter to the program that will add one point each time the dragon gets hit by a lightning bolt.
Hint: Take a look at your Princess/Unicorn code to see how a Counter is created.
Note:
I reset the Point Counter as a separate program in the Lightning Bolt.
- Program #4: Add A Timer
- A 10 second clock will start when the green flag is selected. At zero seconds, all activity will seize: The wizard, dragon and bolts will no longer be active. The counter will also stop.
Hint: Take a look at the Princess/Unicorn code to see how a Timer is created.
Note: Note:
I reset the Timer (with the Point Counter) as a separate program in the Lightning Bolt.