TRIGGERS Triggers tell a script to start executing There are four types of triggers: When green flag is clicked When I am clicked When is pressed When.

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.
SCRATCH Lesson Two – Interactive Concepts Using Sensing, Operators, and Variables.
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
Michael Parkes Dudley LA What can Scratch do? Make simple games, animations, presentations and stories.
Harry Potter Scratch Game
Mr. Wortzman INTRO. TO COMPUTER SCIENCE. UNIT 1 – CUSTOM BLOCKS.
1 An intro to programming concepts with Scratch Session 3 of 10 sessions Repetition and variations.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Learn… Create… Program. Manipulation of Multiple Media Connects with youth culture Scratch is a new graphical programming language designed to support.
1 An introduction to programming concepts with Scratch.
An intro to programming concepts with Scratch Session 2 of 10 sessions I/O, variables, simple computing.
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.
Conversational Computers
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.
GAME:IT Junior Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game.
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.
INTRODUCTION TO THE SCRATCH PROGRAMMING ENVIRONMENT.
Summer Computing Workshop. Session 4 Loops  At the heart of their functionality, loops enable blocks of code to be executed more than once  Loops represent.
Ms. Deveny Second Semester  Introductions  Interview your table partner  Name  Why taking CPD  Computer experience  Favorite game?
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.
Using MIT Scratch for Programming and Control Exercise 3 Ball Game Year 9 ICT Autumn Term 2007.
Programming & Scratch. Programming Learning to program is ultimately about learning to think logically and to approach problems methodically. The building.
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.
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.
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.
Algorithms Writing instructions in the order they should execute.
CONTROL FLOW The order in which blocks are executed is called the “control flow” of the script So far all our scripts have just executed blocks in the.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Image #1 Getting Started
1 Use different costumes in Scratch to make an animation effect Synchronise interaction between 2 or more sprites Lesson 3: Learning Objectives.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Computer Programming Modeling a Passive Solar Home.
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.
Computer Programming Modeling a Passive Solar Home.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Functions / Blocks.
Create a Halloween Computer Game in Scratch
Dancing on Green Light.
Programming & Scratch.
Scratch for Interactivity
Interacting Sprites Module 3: Investigation 1
Exploring Mathematical Relationships Module 5: Investigation 3
Unit 2 Getting Started With
Scratch for Interactivity
Go to =>
Introduction to TouchDevelop
Image #1 Getting Started
Game Over Module 4 Lesson 2.
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.
Presentation transcript:

TRIGGERS Triggers tell a script to start executing There are four types of triggers: When green flag is clicked When I am clicked When is pressed When I receive a message more on messages later

TRIGGERS Exercise: Rewrite your square drawing script to draw a square whenever the space bar is pressed. Clear the screen before each new square.

THREADS You can build multiple scripts in the script area for any sprite (or the stage) All these scripts run at the same time (assuming their triggers occur) Each script is called a “thread”

THREADS Exercise 1: Write scripts to allow the user to move a sprite around the stage with the arrow keys. Exercise 2: Write scripts to have your sprite draw a red square when the 'r' key is pressed and a blue square when the 'b' key is pressed

SPRITE APPEARANCES Each sprite can have multiple costumes to change its appearance This allows us to make a sprite look different at different times but act the same Costumes can be added/changed in the “Costumes” tab above the script area

SPRITE APPEARANCES If a sprite has multiple costumes, you can use the and blocks to change which one is shown Sprites can also disappear and reappear using the and blocks

SPRITE APPEARANCES Exercise: Use the ballerina sprite (under “People” folder) and make her dance as follows: When the up arrow is pressed, change to the “jump” costume and move slightly up, then come back down When the down arrow is pressed, change to the “crouch” costume and move slightly down, then come back up

TIMING Sometimes things happen too fast. We can slow them down with Exercise: Fix your ballerina program to make the jumps and crouches noticeable.

TIMING Exercise: Write a BYOB program that involves two sprites. When the space bar is pressed, the sprites should “jump” one at a time. The second sprite should not leave the ground until the first has landed.

MESSAGES We can use the block to time things to happen at certain intervals But what if the timing changes? To make one sprite’s action trigger another, we can use messages Using, a sprite can send a message that will be heard by all other sprites Other sprites can respond to the message by using a trigger Each message must have a unique name

MESSAGES Exercise: Write a BYOB program involving two sprites having a conversation. The first sprite should say "Hello" for a few seconds. Then, the second sprite should say "How are you?" for a few seconds, to which the first sprite should respond "Fine, thanks!" The program should continue to work even if the times are changed.

VARIABLES Thought exercise: How can we make sprites move at different “speeds”? Variables allow us to store data and modify or retrieve it later Check out the Variables category Look around for built-in variables What shape are variable blocks?

VARIABLES When we click “Make a variable” we get a dialog box The name can be anything you want “For all sprites” means all sprites will be able to see and edit the variable Why might this be useful? Why might it be dangerous? “For this sprite only” means only the current sprite can see and edit it

VARIABLES Exercise: Write a BYOB program that has a ball bouncing around the stage. The up and down arrows should increase and decrease the speed at which the ball moves. Use the to handle bouncing.

INPUT You can ask the user for input using The response is stored in Note that is just a built-in variable Often, you’ll be storing the input in a variable for later use

INPUT Exercise 1: Write a script to do the following: Ask the user for a number between 1 and 10 Draw that many squares Exercise 2: Write a script to do the following: Ask the user for a number between 1 and 10 Ask the user for a number between 1 and 255 Draw the first number of squares with the pen color set to the second number