Using MIT Scratch for Programming and Control Exercise 4 – Cat and Dog game Year 9 ICT Autumn Term 2007.

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

In this tutorial, we are going to create: A race car that the user can control with the arrow keys for direction and speed. A simulated road with a striped.
Create a Simple Game in Scratch
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.
Learn… Create… Program. Manipulation of Multiple Media Connects with youth culture Scratch is a new graphical programming language designed to support.
Digital Art in Scratch part 1 Barb Ericson Georgia Tech Oct 2010.
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.
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.
We will be creating a spaceship that simulates real movements in space. The spaceship will fire a laser beam that can destroy targets. The spaceship will.
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.
2015 CSE/EGR Summer Camps 1 Computer Science Concepts 1. What is an algorithm? 2. Binary information coding 3. Programming concepts via Scratch Designed.
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.
Using MIT Scratch for Programming and Control Extension work – clock project Year 9 ICT Autumn Term 2007.
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.
Unit 3 Music and Sound Evangel College S.2 ICT.
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
Scratch Another computer programming language Developed by MIT in 2003
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.
Hyperstudio: A Beginner’s Tutorial By Judy Swaim.
Variables and Random Numbers Computer App Session 4.
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.
 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.
1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes 
ICT/COMPUTING RULES Only use software allowed by the teacher
Computer Programming Modeling a Passive Solar Home.
Computer Programming with Scratch JAOIT 8. Scratch Scratch is a programming language that makes it easy to create your own interactive stories, animations,
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
Index Background Costumes Making object walk smoothly Controlling an object with the keyboard Control an object with the mouse Changing costume when hit.
Using MIT Scratch for Programming and Control Programming 9.
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Exploring Mathematical Relationships Module 5: Investigation 3
Co-ordinates And Geometry Module 6: Investigation 2
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.
Year 11 DTG Intermediate Using MIT Scratch for Programming and Control Exercise 2 Controlling movement with the keyboard Year 11 DTG Intermediate.
Unit 2 Getting Started With
Scratch – Simple Programming
Scratch for Interactivity
Introduction to Object-Oriented Programming
Scratch – Simple Programming
Lesson 1 Introduction to Scratch Basic blocks
Go to =>
Go to =>
Image #1 Getting Started
Game development using Scratch
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Using MIT Scratch for Programming and Control Exercise 5 – Drawing with Scratch Year 9 ICT Autumn Term 2007.
Scratch – Simple Programming
Presentation transcript:

Using MIT Scratch for Programming and Control Exercise 4 – Cat and Dog game Year 9 ICT Autumn Term 2007

What you will learn: Revision – making the sprite walk Revision – controlling sprite with arrow keys Walking with keyboard control Importing a new sprite and costumes Creating automatic motion Creating interaction between sprites Setting a countdown using variables Setting a hit count using variables Scoring using variables Importing sounds Importing backgrounds

Revision – Getting the sprite to walk (using costumes) Before starting this exercise, dump any existing script into the left had side of the screen (this will delete it) Click on the costumes tab Rename the sprite as Cat Rename the costumes Catwalk1 and Catwalk2

Revision – Getting the sprite to walk (using costumes) Create a new script and drag in the move 10 steps instruction Drag in the switch to costume and select Catwalk2 from the drop down list Drag in a wait and change the value from 1 sec to 0.1 secs Repeat the move, switch costume and wait steps to go back to Catwalk1 Add an if on edge, bounce instruction

Revision – Driving the mouse with the arrow keys We will use the change x by and change y by instructions to order to ensure the correct up and down vertically or side to side horizontally movement of the Sprite Before completing this exercise dump your existing script into the left hand side of the screen (this will delete it)

Revision – Driving the mouse with the arrow keys Start a new script with the when green flag pressed and forever instructions Choose the if condition instruction and drag in the key pressed instruction from the sensing topics. Set the key pressed to down arrow Add the point in direction and change y by set instructions Set point in direction to 180 and change y by to -10

Revision – Driving the mouse with the arrow keys We will now copy the main part of the script then edit the sub script for each movement of the cat for each of the four arrow keys Click on the copy (stamp symbol) tool then click on the word if in the script. This will create a copy of that part of the script.

Revision – Driving the mouse with the arrow keys Repeat this process twice more in order to create the scripts for each different movement of the sprite Drop the three new copied sets of instructions inside the forever instruction

Revision – Driving the mouse with the arrow keys In the second instruction set Set the key pressed to up arrow Set the point in direction to 0 Set the change y by to 10 In the third instruction set Set the key pressed to right arrow Set the point in direction to 90 Set the change y by to 10 In the forth instruction set Set the key pressed to left arrow Set the point in direction to -90 Set the change y by to -10

Revision – Driving the mouse with the arrow keys Click the green flag button. It should now be possible to drive your cat sprite around the screen using the arrow keys

Cat walking with keyboard control Looking back over the previous exercises it should be possible to make a script combining what you have already learned that allows you to walk the Cat sprite around the screen using the arrow keys Note that two scripts have been created here as an expedience for display purposes – it is possible to combine all of this into one script (Keep this script – it will be a part of the game)

Importing a new sprite and importing costumes Working in the exercise already started, click the centre button below the stage. This allows you to import a new sprite onto the stage Browse the Animals folder and select dog2-b

Importing a new sprite and importing costumes The dog only comes with one costume and we need two to make it walk. With the dog sprite selected click the costumes tab and click import Select dog2-c

Importing a new sprite and importing costumes Rename the dog sprite as Dog Rename the costumes as Dogwalk1 and Dogwalk2

Importing a new sprite and importing costumes In the game the dog will walk around the screen automatically. Create the script illustrated The instruction from the motion topic will make the wander round but not in a straight path The instruction from the sensing topic will cause the dog to interact whenever it touches the cat

Setting the countdown for the game (using variables) You need to create a variable in order to make a counter which counts down from 15. You can create this script with one or other of the sprites selected or with the stage selected Click the variables topic, click Make a variable. Name the variable time.

Setting the countdown for the game (using variables) Create the script illustrated The time should be displayed in the corner of the stage

Counting the number of times the dog hits the cat You can create this script with one or other of the sprites selected or with the stage selected Create two more variables called hit and toggle (toggle is needed so that the hit count does not keep on going all the time that the dog and cat are in contact

Counting the number of times the dog hits the cat This script sets the toggle to a value of 0 whenever the sprites are not in contact

Counting the number of times the dog hits the cat This script changes the value of hits by one if the cat is touching the dog and the value of toggle is 0. As soon as the instruction is carried out toggle is set to a value of 1 and the hit count will then not go up until the sprites have separated and then touch again

Scoring feedback This script gives alternative messages from the cat sprite, giving feedback to the user of the game according to how well you have avoided the dog and giving instructions for starting a new game Since this script determines the action of the cat, create this script with the Cat sprite selected The dialogues are all found in the purple looks topic

Importing sounds As this action changes things to do with the whole game, change actions on the stage. Click the stage button to the left of the sprite symbols below the stage. Click the Sounds tab and import the sound DrumSet1 Click the Scripts tab and create the simple script shown

Importing a background Click the Backgrounds tab and browse for a new background.

Developing the game In this example two dogs have been created which react with each other and chase the cat! (Simply import another dog as before but change its colour) Notice that the scripts have been slightly amended so that the dogs and cat now go to centre positions in the stage at the beginning of the game.

Developing the game