Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Forest archery game


Published on

Published in: Sports, Technology
  • Be the first to comment

  • Be the first to like this

Forest archery game

  1. 1. Forest Archery Game
  2. 2. Forest Archery Game Starter Activity: Target Games Check out the target style games:
  3. 3. Forest Archery Game In this lesson you will learn how to use random numbers, variables and collision detection. You will create an archery style target game. Lesson  Become more familiar with translating an algorithm into code  Understand the use of variables  Use if …else conditional statements Objectives
  4. 4. Watch the video Forest Archery which is in the programming in scratch folder in Groupwork to learn how to create a target game. Forest Archery Game
  5. 5. Task 12: Designing the Solution Think about the two main things that you will need to code: 1. moving the target 2. hitting the target Code your program from the algorithms on the next two slides. If you get struck, look back at the video. Forest Archery Game
  6. 6. Algorithm to move target (in Target sprite) when flag is clicked repeat forever glide in 1 second to a random position* * x is a random number from -240 to 240 y is a random number from -180 to 180 Forest Archery Game
  7. 7. Algorithm to move sight and fire (in Sight sprite) when flag is clicked repeat forever go to mouse location (the mouse x and mouse y positions) if the mouse button is down (the user has clicked the mouse) if the sprite is touching the target sprite add 1 to score variable play Pop! sound Say “Hit!” for 0.5 seconds Forest Archery Game
  8. 8. Task 13: Hit and Miss Change your program to so it takes 1 point off the score every time a player misses! If touching target change score by 1 play Pop! sound Say “Hit!” for 0.5 seconds else change score by -1 play Plunge! sound say “Miss!” for 0.5 seconds Forest Archery Game You have already programmed this section
  9. 9. Task 14: Stay Positive! Adapt the program so that the player will never get a negative score. In order to achieve this you will change your program so that points are only taken away when the players score is above zero. Forest Archery Game
  10. 10. Task 15: Bullseye! Using if and touching colour blocks, change the program so that when the target is hit, it adds the following to the score: •Gold - 5 points (and says “Bullseye!”) •Red - 4 Points •Blue - 3 Points •Black - 2 Points •White - 1 Point Forest Archery Game
  11. 11. Variables In this game, you used a variable block to keep track of the score. A variable is a space in a computer’s memory where you can hold information used by your program – just like storing things in a box. Once a variable is created, the information stored inside it can be set or changed (that is, varied – hence the word “variable”). Forest Archery Game
  12. 12. Plenary Question 1 Look at the adjacent script. The programmer has made 3 errors. Can you identify them? 1. 2. 3. Forest Archery Game
  13. 13. Forest Archery Game Keywords  Understand the use of an algorithm to develop a solution to a problem  Translate an algorithm into code  Use conditional statements Objectives  Collision  Variable  Random  Repeat  Forever  Touching  Value  Nesting   