Create a Simple Game in Scratch

Similar documents
Creating Computer Games

Introduction to Turtle Art

Lesson 2 Game Basics

Add in a new ghost sprite, and a suitable stage backdrop.

GAME PROGRAMMING & DESIGN LAB 1 Egg Catcher - a simple SCRATCH game

In this project you ll learn how to create a times table quiz, in which you have to get as many answers correct as you can in 30 seconds.

Pong Game. Intermediate. LPo v1

Let s start by making a pencil, that can be used to draw on the stage.

In this project we ll make our own version of the highly popular mobile game Flappy Bird. This project requires Scratch 2.0.

Pong! The oldest commercially available game in history

In this project you ll learn how to create a platform game, in which you have to dodge the moving balls and reach the end of the level.

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

Brain Game. Introduction. Scratch

Lesson 8 Tic-Tac-Toe (Noughts and Crosses)

Scratch for Beginners Workbook

In this project you ll learn how to create a game, in which you have to match up coloured dots with the correct part of the controller.

Ghostbusters. Level. Introduction:

Memory. Introduction. Scratch. In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

Flappy Parrot Level 2

Lost in Space. Introduction. Scratch. You are going to learn how to program your own animation! Activity Checklist.

Create Your Own World

Open the Tech Toys Scratch project. Your club leader will give you a copy of this project, or you can open it online at jumpto.cc/toys-go.

Whack-a-Witch. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Create a game in which you have to guide a parrot through scrolling pipes to score points.

Game Making Workshop on Scratch

Alright! I can feel my limbs again! Magic star web! The Dark Wizard? Who are you again? Nice work! You ve broken the Dark Wizard s spell!

In this project you ll learn how to create a game in which you have to save the Earth from space monsters.

Fireworks. Level. Introduction: In this project, we ll create a fireworks display over a city. Activity Checklist Follow these INSTRUCTIONS one by one

Clone Wars. Introduction. Scratch. In this project you ll learn how to create a game in which you have to save the Earth from space monsters.

Pong! The oldest commercially available game in history

Create Your Own World

Programming with Scratch

In this project you ll learn how to code your own musical instruments!

Rock Band. Introduction. Scratch. In this project you ll learn how to code your own musical instruments! Activity Checklist.

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Kinect2Scratch Workbook

Fish Chomp. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Let s start by making a pencil that can be used to draw on the stage.

a. the costumes tab and costumes panel

AIM OF THE GAME GLACIER RACE. Glacier Race. Ben Gems: 20. Laura Gems: 13

Introduction. Overview

A. creating clones. Skills Training 5

Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game

Scratch Programming Lesson 13. Mini Mario Game Part 4 Platforms

Assessment. Self Assessment. Teacher Assessment. Date Learning Objective(s) Achievement or. NC Level: Game Control Student Booklet P a g e 1

04. Two Player Pong. 04.Two Player Pong

Project 1: Game of Bricks

Step 1 : Earth and Mars Orbit the Sun

Computer with Scratch program.

Creating a Maze Game in Tynker

GAME:IT Junior Bouncing Ball

GAME:IT Bouncing Ball

How to Create Website Banners

Overview. The Game Idea

GAME:IT Junior Bouncing Ball

2D Platform. Table of Contents

STEP-BY-STEP THINGS TO TRY FINISHED? START HERE NEW TO SCRATCH? CREATE YOUR FIRST SCRATCH PROJECT!

COMPUTING CURRICULUM TOOLKIT

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

Introducing Scratch Game development does not have to be difficult or expensive. The Lifelong Kindergarten Lab at Massachusetts Institute

Star Defender. Section 1

The VG-Clip Player. This section is required for anyone that DOESN T own the FULL COLLECTIONS of their card sets And have Cards On-Stage

Teaching Kids to Program. Lesson Plan: Interactive Holiday Card

Explore and Challenge:

2

pla<orm-style game which you can later add your own levels, powers and characters to. Feel free to improve on my art

Kaltura CaptureSpace Lite Desktop Recorder: Editing, Saving, and Uploading a Recording

CISC 1600, Lab 2.2: More games in Scratch

Scratching the Surface of Pong: Enriching Linear Equations with Computer Programming

You are going to learn how to create a game in which a helicopter scores points by watering flowers in the city.

ChatBot. Introduction. Scratch. You are going to learn how to program your own talking robot! Activity Checklist. Test your Project.

How to do automatic horizontal background scrolling in Scratch

Programming I (mblock)

Scratch Primary Lesson 5

More Actions: A Galaxy of Possibilities

Part II: Number Guessing Game Part 2. Lab Guessing Game version 2.0

Photoshop CC: Essentials

Introducing Photo Story 3

Creating Photo Borders With Photoshop Brushes

Ada Lovelace Computing Level 3 Scratch Project ROAD RACER

Starting from LEARNER NOTES edited version. An Introduction to Computing Science by Jeremy Scott

1 Shooting Gallery Guide 2 SETUP. Unzip the ShootingGalleryFiles.zip file to a convenient location.

Before displaying an image, the game should wait for a random amount of time.

Parallax Scrolling Tutorial Created in Drogheda by Seamus Minogue and updated for Clonakilty CoderDojo 15/06/2012 PARALLAX SCROLLING

Unit 6.5 Text Adventures

Module 4 Build a Game

KEEPING SCORE: HOW TO USE SCORES, LIVES AND HEALTH

Google Photos Online Basics

Photo Story Tutorial

How to use Photo Story 3

Introduction to Parametric Modeling AEROPLANE. Design & Communication Graphics 1

ADD A SPARKLE TRAIL TO A PHOTO

Copyright 2017 MakeUseOf. All Rights Reserved.

G54GAM Lab Session 1

Defend Hong Kong s Technocore

Game Design Curriculum Multimedia Fusion 2. Created by Rahul Khurana. Copyright, VisionTech Camps & Classes

Eduphoria Guide To Create a Test

Creating Digital Stories for the Classroom

One method for removing and replacing the sky in an image

Using Game Maker. Getting Game Maker for Free. What is Game Maker? Non-event-based Programming: Polling. Getting Game Maker for Free

Using Game Maker. Oregon State University. Oregon State University Computer Graphics

Transcription:

Create a Simple Game in Scratch Based on a presentation by Barb Ericson Georgia Tech June 2009 Learn about Goals event handling simple sequential execution loops variables conditionals parallel execution message passing

Game Description We will make a game where the player controls a baby using the arrow keys to catch a falling ball. If the baby misses the ball the game is over. Start up Scratch Click on Scratch.exe Save As... BabyCatch

Delete the Cat Click on the scissors and your cursor turns to scissors and then click on the cat to delete it Or right click on the cat and pick delete Add the Baby Click on the button with the picture of folder with a star in it if you hover over it, it says "Choose new sprite from file"

Select the People Folder Scroll to the Baby Click on the baby and then OK

Resize Your Sprite! You can make your sprite larger or smaller by using the grow sprite or shrink sprite icons. You click on one of these icons, then click on your sprite until it is the size you d like. shrink grow Move the Sprite Select (click on the arrow and then on the sprite) and click and drag the sprite to the bottom of the window

Add a Background Click on the Stage In the bottom right area Click on the Backgrounds tab In the center Click on the import button Pick a background Like bedroom1 in indoors Event Handling We want to control the baby using the arrow keys When we click the left arrow the baby should move left When we click the right arrow the baby should move right This is a form of event handling Responding to user actions like mouse clicks and key presses

The Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high. 180 Moving left decreases the x value Moving right increases the x value -240 0,0 240 at the center of the stage -180 Programming the Baby Click on the baby sprite in the view of the sprites and stage Bottom right section Click on the Scripts tab In the center area This allows us to create scripts (programs) for the baby Each sprite can have several scripts This area shows the current sprite

Respond to Arrow Keys Click on Control (orange) and then drag out "when space key pressed" Respond to Right Arrow Click on down arrow next to space and select right arrow Click on Motion (blue) and drag out "move 10 steps"

Change the move amount Click on the 10 it will highlight in blue Type 5 and press enter You may want a larger value, esp. when speeding up the ball Respond to Arrow Keys Click on Control (orange) Drag out "when space key pressed" Change "space" to "left arrow" Click on Motion Drag out "move 10 steps" Change it to -5 (to move left) Click on the stage and try out the left and right arrow keys Does the sprite leave the window?

Paint a Ball Click on the paint brush and star It will say "Paint new sprite" if you hover over it Draw the Ball Click the circle tool and then use the eyedropper to pick a color and then click in the drawing area and drag to create the ball Circle tool and eyedropper Drawing area Click ok when done

Size the ball as desired and move it to the top Click and drag the ball to the top of the window Make the Ball Fall When the green flag is clicked we want the ball to always start at the top and fall down Click on Control (orange) Drag out "When green flag clicked"

Start the Ball Click on Motion (blue) Drag out go to x # y # this will always start the ball at its current position (Scratch doesn t automatically put it back for you). Sequential Execution One block is executed after the other In order from top to bottom When the green flag is clicked the ball will go to the specified x and y location

Loops We want the ball to continue to move down unless the baby catches it How do we make this happen? We could use lots of blocks one after the other But, that would be slow and repetitive We need a way to repeat a block or set of blocks This is called a loop or iteration Make the ball fall Click on Control (orange) drag out "forever" Click on Motion (blue) drag out change y by 10 Change it to -1 Or use Motion "point in direction (down)" and "move (1) step" Try it out!

Catch the ball! If the ball touches the baby then it is caught Let's track how many balls we have caught with a score We will increment the score each time we catch a ball Variables If we are going to keep track of the score We want something to hold the current score And we want to be able to change the score We want the value to change or vary This is called a variable

Track the score When we start the game set the score to 0 Click on Variables (red) Click on Make a Variable Name it score Set score to 0 In the ball script Drag the forever down Drag out "set score to 0 Drag the forever back up Notice the score showing on the window

Conditionals We want to increase the score if the baby caught the ball So this action will only occur only if some condition is true This is called a conditional or an if Did we catch the ball? From Control drag out an if Check if the ball is touching the baby Get this in Sensing If this is true increment the score From Variables

Increment the score Try it out! is this what you expected? Computers do what you tell them to Not what you want them to Reset the Ball If we caught the ball Increment the score And move the ball to some random spot at the top of the window So we don t keep increasing the score

Reset the Ball Click on Number drag out "pick random 1 to 10" drop on the x value after go to x: change the 1 to -235 and change 10 to 235 change the y value to match the y in the first go to x # y # Adding Losing If the baby doesn't catch the ball it just gets stuck at the bottom of the screen Let's tell the player that he or she lost

Add a text sprite Click on the Paint new sprite button Click on the T for text Pick the color Modify the font size Move the square to where you want the text Type You Lost! Hide the sprite We don t want to tell the player that she lost when the game starts So hide the message when the game starts Click on Control drag out "when green flag clicked" Click on Looks drag out hide

Check if Lost If the Ball's y position gets near the bottom (near -180) Click on the ball sprite Drag out an if from Control Drag out a blank < blank From Numbers Add a y position From Motion Type in -175 Broadcast a message Sprites communicate by passing messages One sprite broadcasts the message Other sprites can listen for it and react to it when they receive it Click on Control drag out "broadcast blank" click on the drop down arrow next to new name it lost Add stop script to stop the forever loop

Receive Lost Click on the text sprite Click on Control drag out "when I receive blank" click on the down arrow and select lost Click on Looks drag out show Click on Control drag out stop all to stop all scripts Parallel Execution We have several things happening at the same time when the green flag is clicked This is called parallel execution More than one thing happening at a time

Create Instructions Click on the Show Project Notes icon in the upper right corner Add the instructions Press OK Test your game Click the green flag Save your game with the Save/Save As button See the enhancements you need to add to this base implementation - next page.

Enhancements You Need To Do! Add the ability to win When you reach a certain score, say 20 Design a Text sprite to display "You Win!" Have the baby spin around with joy (don't "stop all") Speed up the ball each time it is caught Increase by 0.5 up to a max of 6 steps/pixels per loop iteration (increase <- -> arrows speed) Add at least one more sprite to catch Make it possible to win; more sprites -> slower speeds Add a killer sprite to avoid If hit by this killer sprite, you lose Concept Summary Variables can hold values and can change value Forever loops repeat all the commands inside of them one at a time until the script is stopped or all scripts are stopped Conditionals ifs only execute the body of the if when the condition is true Sprites can pass messages and receive them Sprites can react to events like clicking the green flag and pressing the left or right arrow keys Sprites can have several scripts, costumes, and sounds Things can happen one after the other sequential execution or at the same time parallel execution