Code Club Session 3 Shark Eats Fish. Picture of finished product here.

Slides:



Advertisements
Similar presentations
Getting Started with PowerPoint
Advertisements

Introduction to Macromedia Director 8.5 – Lingo
Create a Simple Game in Scratch
Create a Simple Game in Scratch
Michael Parkes Dudley LA What can Scratch do? Make simple games, animations, presentations and stories.
Scratch for Storytelling Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Pong! “The oldest commercially available game in history” Resources created from the video tutorials provided by David Phillips on
Harry Potter Scratch Game
Helicopter Game Tutorial
1 An intro to programming concepts with Scratch Session 3 of 10 sessions Repetition and variations.
A Christmas Scratch game
Lights Camera Action! Part 3: BDE Events By Deborah Nelson under the direction of Professor Susan Rodger Duke University July 2008.
This game is loosely based on the Whack-A- Mole arcade game.  Each game starts with 45 seconds of play.  Moles randomly pop out of holes on the landscape.
Write Your First Computer Game!. Coding: Programming Languages Just like you can speak Chinese to someone who understands Chinese to tell them what to.
Scratch Programming Session 9 of 10 Review elements to use in stories, games, etc.
Scratch Programming Session 6 of 10 If-then-else statements interactions Final projects specifications.
Scratch Understanding some programming techniques using Scratch Resetting, Parallelism and Events.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Making a Timer in Alice.
Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other.
Introduction to Scratch!
Making a Boat Racing Game in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2010.
Using MIT Scratch for Programming and Control Exercise 6 – Creating a Scratch Packman Year 9 ICT Autumn Term 2007.
How to make a Shooting Target game in Scratch!. WE ARE GOING TO MAKE A TARGET GAME. This game will have: A Target that will move when clicked. A Timer.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Introduction to Scratch. What is Scratch? Scratch is a control program that enables you to create your own interactive stories, animations, games, music,
Image #1 Getting Started
WHAT IN THE WORLD IS SCRATCH??? AN INTRODUCTION TO COMPUTER PROGRAMMING By MD Showman.
Making a Sprite Dance Barb Ericson Georgia Tech June 2011.
The Essentials of Alice Mrs. Jayne Slease SBMS CTE Computer Science and Animation Credit to Duke Students under the direction of Professor Susan Rodger.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Computer Programming Modeling a Passive Solar Home.
Tutorial for Arrays and Lists. Description This presentation will cover the basics of using Arrays and Lists in an Alice world It uses a set of chickens.
Using MIT Scratch for Programming and Control Exercise 1 Creating movement Year 11 DTG 2012.
An Introduction to Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University, June 2009 Updated June 2014 by Ellen Yuan.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
How to create a sprite Delete a sprite (e.g. the cat) by right clicking on it and choosing delete. Go to the bottom right hand corner and choose a new.
How to create a sprite Delete a sprite (e.g. the cat) by right clicking on it and choosing delete. Go to the bottom right hand corner of the stage and.
Using MIT Scratch for Programming and Control Exercise 4 – Cat and Dog game Year 9 ICT Autumn Term 2007.
Welcome to Scratch By Miss Key. The Main Screen Viewing screen with choice of views.
 SCRATCH is a new programming language that lets you create your own interactive stories, animations, games, music, and art.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
How to create a basic game in Scratch. The Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high x increasesx decreases.
Repetition everywhere – comparing while in a method and as an event Susan Rodger Duke University July 2010.
Today's Ninja Challenge: Write Your First Computer Game!
Teaching Kids Programming with Chromebook Digital Convergence Lab, NIU.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Create a Halloween Computer Game in Scratch
Broadcasting (Adding a new level)
Scratch for Interactivity
Scratch Unit Overview We are going to look at computer programming and how to create your very own computer game The piece of software we will be using.
Scratch – Simple Programming
Scratch for Interactivity
Introduction to Object-Oriented Programming
Scratch – Simple Programming
Go to =>
Scratch for Storytelling
Go to =>
Go to =>
Image #1 Getting Started
Game Over Module 4 Lesson 2.
Creating a Simple Game in Scratch
Lesson Nine Variables.
Presentation transcript:

Code Club Session 3 Shark Eats Fish

Picture of finished product here

What will we learn ?  How to move a sprite  What is an “if” statement and what the “not” operator does  How we can use co-ordinates  How to make one sprite react to another sprite  How to use variables

First create a new project  Click “File”, then click “New”  Now save the new project  Click “File”, then click “Save As”  Click “X:”, click “OK”  Click “Computer Club” – you may have to scroll down, click “OK”.  Click “Shark Eats Fish”, click “OK”  Finally type your name in the “New Filename” box and put the words “Shark Eats Fish” afterwards.  For example “Mr Steele – Shark Eats Fish”

Backgrounds  Click the stage icon in scratch, it is the white box on the bottom right of the screen.  Now click the “Backgrounds” tab.  Click “Import”, select “Nature” click “OK”  Scroll down till you find the picture “underwater”  Select this one and click ok.  Now delete the white background, click the “x”

 We are now going add 3 costumes for our shark  Click “Sprite1” the cat. Take this opportunity to rename it “Shark”  Now click “Costumes” then click “Import”  Select “Animals”, click “OK”  Scroll down and select the image “shark1-a”  Repeat the process selecting “shark1-b” and “shark1-c”  Delete the cat costumes if you still have them. Costumes

 We are now going to select some sounds  Click “Stage”, then click the “Sounds” tab  We are going to keep the “pop” sound that should already be there but add 2 new sounds.  Click “Import”, select “Effects”, then click “Bubbles” and click “OK”  Click “Import” again, this time select “Rattle” and click “OK”  Now we need to make our sprite smaller.  Click the shark sprite  Then click the “Shrink Sprite” icon, once you have click then click the shark to make it smaller.  Don’t make it too small.  Click “File” then click “Save” Final setup

 We are going to make the shark follow the mouse pointer.  Click the “Shark” sprite, select “Scripts”  From the control menu pull down add the following commands.  Try this now – what happens ? Moving the shark

 Next add the command “Move 2 steps” into the “Forever” loop.  What do you think will happen ? Moving the shark  As you can see the shark looks like it is swimming upside down !  To fix this click the “only face left-right” icon  Try again

Fixing bugs  What happens when the shark catches the mouse pointer ?  We call this a bug. The program is doing something we don’t want it to, so we will fix it.

The “If” statement  We are going to use something call an “if” statement. We use this lots in computing.  We say. If (condition is true) { Do something }

If statement continued  Our “if” statement looks like this.  To fix our bug we want to only move “if” the shark is “not” touching the mouse pointer. If (shark is not touching mouse pointer) { Move 3 spaces }  Important: The “not” keyword reverses our logic. If we use this operator then we change a condition from true to false, or from false to true.

If statement continued  Change the script to look like this.  Notice that we use the green “not” operator. This has the effect or reversing the condition in blue (touching mouse-pointer).  Try running this again

 Whenever we start we always want the shark to appear in the same position and have the same costume.  Add the following commands. Setting up the shark  Make sure you choose shark costume 1-b. This will make it look like it is trying to eat our fish !  We position the shark at the co-ordinates 0,0 what does this mean ?

 Everything on the stage has a pair of co-ordinates  As you move your mouse pointer around the screen you can see the co-ordinates change depending where you are pointing.  0,0 is always the middle of the screen Coordinates

 Before we forget lets add some sound  Click the stage and add the following commands. Background sound  So now we have our shark that swims, we have a good background and an appropriate sound effect.  Click “Save” again

 So far we have found out how to make sprite move in the direction we want it to.  First we point it in the correct direction  Then we issue a move command  We fixed a bug and learnt about the “if” command and the “not” operator.  We have also learnt about co-ordinates and how we can use them to move a sprite to a preset location.  We will learn more about co-ordinates as we proceed. Quick Review

Adding the fish  We will first add the fish and make it swim across the screen.  We are going to control the fish with an event, this is important because when the fish is eaten we want to be able to make the event fire again.  First add a fish, select “New Sprite From File”  Select, “Animals” the “Fish2”  Make the fish smaller as you did before.

Making the fish swim  We will use an event to make the fish start to swim. This will let us call this event again in the future when the fish has been eaten.  Click the “Stage” and add the following event.  Now click “Fish2” and add the following script.  Now click the green flag and see what happens.

Let the fish be eaten  We now add logic so that when the shark touches the fish then the fish disappears.  First click “fish2” then change the script so that it reads as shown.  Notice that we hide the fish “if” it is touching the shark. We also broadcast another event “Fish eaten” which we will use in the next slide.

Make the fish come back again  When we eat the fish we want to show it again. We can use the “show” command for this.  Notice that we wait 2 seconds.  Then we broadcast the “Fish2 swim” event again.  We then start the logic from the top again, we “show” the fish and move it to a random position.

Adding effects  First we will add an effect whenever the fish has been eaten.  Click the “stage” and add the following script.  Try this. What happens ?  Now we will add a shark animation whenever the shark eats the fish. Click the shark and add the following script.  Try this. What happens ?

Keeping score  We want to keep score in our game so we need to use a variable for this.  First create a variable. It will be called “score”.  Click “Variables” then click “Make a variable” call it “score”.  Variables are containers that can hold things. We want this container to hold our score.  Next click the stage and update the scripts so that they look like this.  Now, when we start a new game we set the score to 0.  When ever a fish is eaten we increase the score by 1.

Setting a time limit  We will use another variable to keep track of the time and to stop the game after the time runs out.  Create another variable, this time call it “countdown”.  Add the following script to the “stage”  This script sets out “countdown” variable to 15.  Then we repeat the value of our variable (15) and wait for 1 second for each time we repeat.  We also take 1 away from the value of countdown. We use the value of -1 which is the same as saying : countdown = countdown – 1  Finally we run “stop all” this stops all the scripts.

Final Challenges – Game Over Message  If you have time add a game over screen.  Take a copy of the underwater picture, add the words “Game Over”.  Now make the picture appear when the game is over.  Make sure that the correct picture appears when the game starts again.

Final Challenges – Final Score Message  Get the shark to award you a medal at the end of the game based on your score.  Use the say command and “if” statements. If you score between 1 and 5 then say “You got bronze” If you score between 6 and 10 then say “You got silver” If you score higher than 10 then say “You got gold !” If you score 0 say “You need to try harder