Variables and Random Numbers Computer App Session 4.

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

Create a Simple Game in Scratch
Scratch is a Visual Programming Language
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
1 An intro to programming concepts with Scratch Session 3 of 10 sessions Repetition and variations.
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.
Scratch Programming Session 6 of 10 If-then-else statements interactions Final projects specifications.
1 An introduction to programming concepts with Scratch.
1 An introduction to programming concepts with Scratch (in 5 hours + homework)
ITEC Winter An intro to programming concepts with Scratch Quick intro for college citizens. George Stockman MSU CSE.
Digital Art in Scratch part 1 Barb Ericson Georgia Tech Oct 2010.
Adventures in Animation Introduction to Scratch! Michelle Venable-Foster June 2006.
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.
CATCH SCRATCH! Programming from Scratch. Remember Scratch?
Scratch Internet- Open Chrome hit “Create” 1.
Introduction to TouchDevelop
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.
Introducing Scratch the Cat
Objects and Methods in Scratch 1. 2 Scratch environment Stage is at upper right (where actors act and information is displayed) Sprite is another name.
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.
2015 CSE/EGR Summer Camps 1 Computer Science Concepts 1. What is an algorithm? 2. Binary information coding 3. Programming concepts via Scratch Designed.
Geometry. 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 are.
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.
Scratch pong challenge Pong is a classic 1970s video game  Open the pongv1.sb2 file in Scratch  Click the.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Monday, October 26 th Entry Task Write two questions you have about chapter 4 and/or the test. Schedule: Chapter 4 quiz 19.1 Electric charge Homework:
Marble Racer. 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.
Cloning in Scratch Computer App Session 6. Cloning in Scratch Learning Objectives: I will clone sprites in Scratch to create copies of an existing sprite.
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.
Adventures in Animation Introduction to Scratch! Michelle Venable-Foster Barb Ericson Dec 2007.
Making a Flappy Birds Game PART 2 – MAKING THE BIRD FLAP AND FALL – AND DEVELOPING THE GAME FURTHER (ADDING ADDITIONAL CHARACTERS, GOODIES, ENEMIES AND.
ICT/COMPUTING RULES Only use software allowed by the teacher
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.
School of Computer Science Space School 2015 Programming a Lunar Lander Game.
Movement Game Design (Scratch).
Create a Halloween Computer Game in Scratch
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.
Unit 2 Getting Started With
Scratch for Interactivity
Introduction to Object-Oriented Programming
Scratch Programming Intro
Stopwatch Cards Stopwatch Cards
Getting Started with Scratch
Go to =>
Lesson Objectives To understand how to make sprites interact
Stopwatch Cards Stopwatch Cards
Go to =>
Stopwatch Cards Stopwatch Cards
Game Over Module 4 Lesson 2.
Stopwatch Cards Stopwatch Cards
Creating a Simple Game in Scratch
Presentation transcript:

Variables and Random Numbers Computer App Session 4

Variables and Random Numbers Learning Objectives: I know what a variable is. I know what a variable is. I can create and use a variable and a random number in Scratch. I can create and use a variable and a random number in Scratch. I will create a simple game where a sprite tries to touch another sprite. I will create a simple game where a sprite tries to touch another sprite.

Follow these instructions: Push in the keyboard, Push in the keyboard, Hands OFF the computer, Hands OFF the computer, Eyes up front, Eyes up front, Voices off, Voices off, Ears listening Ears listening

Now, you may go to the computers Click on your username at the right corner and choose My Stuff. Click on your username at the right corner and choose My Stuff. Open your project from last time. Open your project from last time.

Data Click on the Data category. Make a Variable Click on Make a Variable First, you will add a variable

Name the variable “Score”. For all sprites For all sprites Leave it as is For all sprites (you can have variables for just one sprite, but then they can’t be accessed by other sprites. For almost all variables, you will choose For all sprites.) Cloud Variable Leave Cloud Variable unchecked. OK Click OK

Note that the score has appeared on the screen. New sprite Let’s add a target sprite. From the New sprite area, choose library. OK. Choose an object to be your sprite. Click OK. Shrink the new sprite so it is about the same size as the first sprite.

Now you will code your target sprite Events From the Events category, drag the “when green flag clicked” into the code space. Data Return to the Data category and drag “set score to zero” to be under “when green flag clicked”. This means that every time the game starts, the score is reset to zero.

Control Now you’ll add code so that every time your target sprite touches the first sprite, it will add 10 points. We need to check constantly to see if they are touching, so under this add a “forever” block from the Control category. Add an “if/then” block inside the “forever” block.

Sensing From the Sensing category, drag in the first “touching” diamond so that it fits after the “if”. In the drop down of the “touching” diamond, select the name of the first sprite. I have Bat1 so my code looks like:

You need to two things when the two sprites are touching. The first is to increase the score. Data From the Data category, drag in “change score by 1”. Change the 1 to a 10. The second thing is to move the sprite to a random part of the screen so it can be caught again. Motion From the Motion category, drag “go to x:__y:__” under the “change score by 10”

But we need random numbers! Operators From the Operators category, drag “pick random from 1 to 10” into the x space. Change the values to -240 and 240. Now do the same for the y value. Change these values to -180 and 180

Try it out! Click the green flag. Use the arrow keys to move the first sprite moves around and catches the second sprite. Make sure that each time you catch it, it moves to a new spot and the score goes up by 10. If you finish early, make a two player game where two sprites race to catch the target sprite first. Think about how you will control their movement.