Lesson 3 - Frogs and Scratch Shark Attack

From Sensors in Schools
Jump to navigation Jump to search

Frogs, Field Maps App and Scratch Shark Attack Lesson

Lesson number Step by step instructions Dropbox video link Teacher resources
Lesson 2a #Learn to Identify Red-rumped Parrots
Lesson 2b #Peron's Tree Frog
Lesson 2c #Planting Native Plants using ArcGIS Field Maps Field Maps App demo video
Lesson 2d #Scratch Shark Attack Game

Learn to Identify Red-rumped Parrots

  • Red-rumped parrots are often found in pairs.
  • Males have a red rump.
  • Females are olive green.
  • They eat grass seeds.

Peron's Tree Frog

  • Found in swamps, wetlands and lagoons.
  • They feed on insects.
  • Their call sounds like a twisted laugh.
  • They are only 6cm long.
  • The frog in the video has climbed a River Bottlebrush (Callistemon sieberi)

Planting Native Plants using ArcGIS Field Maps

  • When revegetating waterways we use the Field Maps app to record the location, date and name of native plants.
  • This helps us find the plants and also record their growth rate.
  • It is very important to do more revegetation around waterways to create more habitat for frogs and other animals.
  • Contact your local government if you need help to organise a planting day especially if you want to plant a nature corridor.

Scratch Shark Attack Game

  • Open Scratch.
  • Click on the scissors tool and delete the cat

  • Click on New Sprite

  • Click on the Animals folder

  • Choose Shark1-a

  • Click on the shrink tool and shrink the shark.

  • Click on the Costumes tab.
  • Select Import to add another Shark costume to create an animation.

  • Add Shark2-b and click on OK.

  • Now you will have two shark costumes.

  • Change the name of sprite to shark

  • Click on teh Scripts tab.
  • Create the following code block.
  • Use the new motion block named point towards

  • Click on the dropdown arrow in the point towards block.
  • Select mouse pointer

  • Run the code by either clicking on the code block or clicking on the green flag
  • The shark will now follow the mouse pointer.

  • Test the code by adding in move 2 steps.
  • Then adding next costume

  • Add a wait 0.1 seconds block if you want to slow down the shark.
  • Later on we can easily remove this block if the shark is too slow.

  • Save the current file.
  • Click on File then Save As

  • Name the file sharkAttack using Camel Notation

Add other Fish to the Shark Game

  • Now its time to add other fish for the Shark to eat.
  • Click on Choose new sprite from file

  • Add a new fish sprite.

  • Use the shrink tool to shrink the fish

  • Construct the following code for the fish sprite.

  • There is a small line placed on top of the fish sprite.
  • This shows the direction the fish will move.
  • Move this line so that the fish points in a new direction.

  • To make sprites appear and disappear we use the Looks blocks show and hide

[[File:Screen Shot 2023-03-08 at 1.29.30 pm.png | 900px

  • Build the following code block for the fish.
  • We have added a new loop block named repeat until <touching shark>
  • The fish will show itself when the green flag is clicked.
  • And the fish will hide if it is eaten by the shark.

Starting the fish sprite from the top left corner

  • At the start of every game we need the fish to start at the top left hand corner of the screen (or stage).
  • To do this firstly drag the fish to the top left hand corner.
  • Then drag the go to x: y: block and place it beneath the When the Green flag is clicked block.
  • Now each time you start your game the fish will start in the top left of screen.

Adding a Score to the Game

  • To keep score of how many fish the shark eats we can add a score board
  • Click on Variables
  • Select Make a variable

  • Name the variable score
  • Ensure it is for All sprites
  • Click OK.

  • A score board will now appear on the stage.
  • You can drag the score board to any position on the stage.

  • Drag the change score by 1 block and place it at the end of the fish code block.
  • Now every time the shark eats the fish the score will increase by one.

Making the Shark sprite faster

  • To make the shark sprite more responsive.
  • Remove the wait block.
  • Make the shark move 3 steps

Making fish appear Randomly on the Stage =

  • To keep the game interesting we need the fish to appear at different locations on the stage each time teh game starts.
  • We can use random blocks. Random blocks generate random numbers. Similar to rolling a dice.
  • Change the values in the random block to -100 and 100
  • We need two random blocks.

  • Add one random block for the x axis and the other random block to the y axis in the go to x: y: block.
  • Now the fish will appear in a random location on the stage.

Duplicate Fish sprites to make School of Fish

  • To make an exact copy of a fish sprite right mouse button click and select duplicate
  • You can make as many fish as you need for your game.

  • The finished game should look similar to the screen capture below.