Go to =>

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Create a Simple Game in Scratch
Scratch is a Visual Programming Language
Michael Parkes Dudley LA What can Scratch do? Make simple games, animations, presentations and stories.
Mission Technology Introduction to Scratch! June 2007.
Pong! “The oldest commercially available game in history” Resources created from the video tutorials provided by David Phillips on
Harry Potter Scratch Game
Adventures in Animation Harry Potter Game Pranali Choubal Kunal Shaw Barb Ericson Dec 2007.
A Christmas Scratch game
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Write Your First Computer Game!. Coding: Programming Languages Just like you can speak Chinese to someone who understands Chinese to tell them what to.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Scratch Understanding some programming techniques using Scratch Resetting, Parallelism and Events.
Digital Art in Scratch part 1 Barb Ericson Georgia Tech Oct 2010.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
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.
Every week: Sign in at the door If you are new: Fill in Registration Form Ask a Mentor how to get started Make sure you are on the Athenry Parents/Kids.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
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!
Using MIT Scratch for Programming and Control Exercise 3 Ball Game Year 9 ICT Autumn Term 2007.
Introducing Scratch the Cat
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.
1 Understand how to use Scratch to: – Animate a sprite – Add sound to your script – Use the forever command to create a loop Lesson 2: Learning Objectives.
Digital Art in Scratch part 1 Barb Ericson Georgia Tech May 2011.
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.
Making a Sprite Dance Barb Ericson Georgia Tech June 2011.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Computer Programming Modeling a Passive Solar Home.
Using MIT Scratch for Programming and Control Exercise 1 Creating movement Year 11 DTG 2012.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Using MIT Scratch for Programming and Control Exercise 4 – Cat and Dog game Year 9 ICT Autumn Term 2007.
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.
Today's Ninja Challenge: Write Your First Computer Game!
ICT/COMPUTING RULES Only use software allowed by the teacher
Scratch Part 2 – Character Commands. What does a command do?  Commands in programming allow an object whatever it is to do something. In the case of.
Computer Programming with Scratch JAOIT 8. Scratch Scratch is a programming language that makes it easy to create your own interactive stories, animations,
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
School of Computer Science Space School 2015 Programming a Lunar Lander Game.
Every week: Sign in at the door Have Fun Ask Share CoderDojo Roscommon "Above.
Scratch Programming Cards
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Exploring Mathematical Relationships Module 5: Investigation 3
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.
Programming Scratch to Control a K’NEX Fairground Ride
Scratch for Interactivity
Introduction to Object-Oriented Programming
Scratch Programming Intro
Learn… Create… Program
Learn… Create… Program
Unit 11 – PowerPoint Interaction
Go to =>
Go to =>
Go to =>
Getting Started with Scratch
Getting Started With Alice
Building a Game in Scratch
Game Over Module 4 Lesson 2.
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
Presentation transcript:

Go to => http://scratch.mit.edu/scratch_1.4/ Install Scratch Go to => http://scratch.mit.edu/scratch_1.4/

Drag 'change x by 10' to the middle area

Double click on 'change x by 10' what happens ?

Now add another 'change x by 10'. Not too close or they will stick Now add another 'change x by 10'. Not too close or they will stick. click on the number and change it to say -10 and double click on that. Try both a few times. What happens ?

If your cat escapes try this button - What does it do ?

Select the orange ‘Control’ button in the top left and drag 'when space is pressed' button on onto the main area.

Pick up the existing 'change x by 10’ and stick it to the bottom of the new button – note it gets a white line when it is close enough to stick.

Click on the little arrow next to 'space' and from the drop down menu select ‘right arrow’.

Drag out another 'when space key pressed' button from the left Drag out another 'when space key pressed' button from the left. Change this one to 'left arrow' and attach the ‘change x by -10’ button

What do your left and right keys do now. Why What do your left and right keys do now ? Why ? What do the up and down keys do ? Why ?

Click on the 'Motion' button in the top left and add two new commands 'if on edge bounce'. What difference does this make you you hit the sides?

Picking the items from Control and Motion, add two more sets Picking the items from Control and Motion, add two more sets. This time pick 'Change Y by 10' and remember to change one to '-10'

Move round again. Do the Up and Down keys work now. Are they correct Move round again. Do the Up and Down keys work now ? Are they correct ? Why not ? How do you fix it ?

Make the up one read ‘10’ and the down one read ‘-10’

The Blue line shows you 'X' or how far left and right the cat is The Blue line shows you 'X' or how far left and right the cat is. The Red line shows you 'Y' or how far up and down the cat is.

If the numbers go from -180 to 180 or from -240 to 240, then what two numbers are right in the middle ?

X is 0 and Y is 0

We need some more room. Make the cat smaller by clicking on the four arrows that are pointing at each other and the clicking on the cat about 20 times (not too many or he will shrink away to nothing)

Every game needs a bad guy ! Pick the yellow star icon in the middle with the grey folder over it.

Double click on Animals...and...

Pick the crab1-b (You'll see why I picked this one in a bit)

Shrink him down with about 25 clicks from the shrinking arrows. Ekkk ! Thats a big crab. Shrink him down with about 25 clicks from the shrinking arrows.

Click on each ‘sprite’ in the bottom right corner Click on each ‘sprite’ in the bottom right corner. See how the middle code window changes. Each sprite has its own commands and jobs to do.

Now we need the crab to move Now we need the crab to move. Click on it down in the bottom right where it says ‘sprite 2’ and add these items. Change the X and Y numbers to 100 and 0

The ‘Forever’ command is called a loop The ‘Forever’ command is called a loop. This is something we want to repeat over and over again, in this case forever. Place these things inside the gap (the colour lets you know where to find them in the button areas on the left):

In the green ‘Operators’ pick up ‘Pick random’ and put it down over the ‘90’ in direction. Set the values to ‘-180’, ‘180’ and ‘40’ for steps to take

If you click on the Green flag you start the game If you click on the Green flag you start the game. The Red circle stops the game (this is useful if it is going a bit crazy)

How about getting the cat back to his starting place when the green flag is clicked ? How would you do that ? ?

Now they both have commands to do when the green flag is clicked. Click on ‘sprite 1’ down at the bottom so you are working on his code and not on the crab. Now add this : Now they both have commands to do when the green flag is clicked.

It looks a little dull. We need a background picture. Click on the white square next to the sprites that says ‘stage’. This is the window you are working in. Now click ‘backgrounds’ and ‘import’

Select ‘Nature’ and then go down and select ‘Underwater’

Hang on ! Cats don’t go under water ?!?!?!?

Click on ‘sprite 1’ and then on Costumes and Import :

Pick Animals again and ‘Starfish-1a’

It is probably a good time to hit ‘SAVE’ (The picture of the disk) and give your new game a name. How about ‘WaterWorld’

At the moment your game doesn’t do anything. Lets give it something to do :) Click on ‘sprite1’ and on ‘scripts’ so we can see the cat… Errr I mean the starfishes commands again. You should already have this bit of code - we are going to add to it :

The ‘if’ and ‘stop all’ commands are in ‘Control’ The ‘say Hello for 2 seconds’ command is in ‘Looks’ Place them just below at the moment - do not put them onto the other bit

If something happens then do this bit. The ‘If’ bit is saying : If something happens then do this bit. The bit inside will only get done when the thing happens. Next change the ‘Hello!’ writing to ‘Game Over’

We need to check if the game is over all the time - so we will need to put this inside another loop so it happens again and again and again and again…...and again…..and…...

In the ‘Sensing’ button area there is an item that says ‘touching. ’ In the ‘Sensing’ button area there is an item that says ‘touching ?’. Drop this into the little hole in the ‘if’ box and then using the drop down menu pick ‘sprite 2’ So we are now saying - If sprite 1 (thats our starfish) touches sprite 2 (Thats the evil crab) then <*** game over ***>

Save it and Test it (click the green flag)

Lets add ‘lives’ to our starfish. Click on ‘Variables’ and ‘Make a Variable’

Type in its name ‘lives’ and press OK A variable is a bit like a ‘box’ with a name on it We now have a box called ‘lives’ and we are going to put a number into that box. How many lives shall we give our starfish ?

Make sure you have sprite1 (the starfish) selected and pickup ‘set lives to 0’ and drop it into the bit of code that has the green flag on top. Now when you start the game it will set the lives. It puts that number into our variable (or box called ‘lives’) Remember to change the number - we don’t start with 0 lives.

Pick up the ‘forever’ loop and take it off the bit of code it is on. We need to swap it for a slightly more clever version ‘repeat until’ This new one will loop but only if something is right - in this case ‘loop if the starfish is still alive then drop out of the loop’

We have a few more changes to make and then we can test... The loop is now changed - it used to run ‘forever’ now it runs ‘forever if’. If you want to get rid of the old one pick up up and drop it back on the left We have a few more changes to make and then we can test...

Move the ‘say Game Over’ and ‘stop’ bits out to the bottom - we only want this to happen at the end when all the lives are gone. In the gap, go to ‘variables’ and add ‘change lives by 1’ and then set the number to be ‘-1’ (otherwise he gains a life each time)

We need to check something to tell us to break out of the loop that runs during the game. Click on the operators button and add in the green command below :

In Variables pick ‘lives’ and in the other box put ‘1’ This means do the game loop until lives is less than ‘1’ He dies when his lives are less than 1 (or zero in this case)

If you have not done it for a while - you should probably hit ‘SAVE’ Then run and see how it works

There is a good change starfish died on the first hit. What happens is he loses a life but then then he is still touching the crab so he drops another life and another and …. We need to send the two of them back to their starting points.

We have added a ‘broadcast’ to the starfish, clicked on the arrow and on ‘new’ and named it ‘go home crab’

And now click on the sprite2 icon down in the bottom right and add this code to crab :

What have we used today ? Loops Variables ‘If’

Thats it - you have just coded your first game. Does that make you a CoderDojo Ninja ?

No.

A CoderDojo Ninja is someone who takes it further and makes it into their own unique game. Some ideas : * What about different graphics ? Where else could you set it ? * Sound FX - it is a bit quiet * The evil guys movement is pretty bad - how could it be better. * Maybe we need 2 evil guys… or 3… or 20 :) * What about good guy seeking bad guys, so they follow you? * Food that shows up for a few seconds to give you back lives. (what DO starfish eat ?) * Things that block the path so you need to go round them. * and most important… add your own ideas...

The Donabate Dojo Mentor team. A big thank you to The Donabate Dojo Mentor team. The Community Centre for the room and setting it up. The mums and dads and adults for transport and help and most of all - Thank you to our new Ninjas (thats you) Comments, suggestions, donations, questions to : email : team@donabateDojo.com Facebook : www.facebook.com/DonabateDojo Twitter :@DonabateDojo Website : www.donabateDojo.com