1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes 

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

Create a Simple Game in Scratch
30 min Scratch July min intro to Scratch A Quick-and-Dirty approach Leaving lots of exploration for the future. (5 hour lesson plan available)
Mission Technology Introduction to Scratch! June 2007.
Scratch for Storytelling Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Harry Potter Scratch Game
Adventures in Animation Harry Potter Game Pranali Choubal Kunal Shaw Barb Ericson Dec 2007.
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.
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.
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.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
INTRODUCTION TO THE SCRATCH PROGRAMMING ENVIRONMENT.
Introduction to.
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!
1 CSC 221: Computer Programming I Spring 2010 Objects and classes: a broad view  Scratch programming review  object-oriented design, software objects.
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.
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.
CoderDojo Roscommon. Today's Ninja Challenge: Create a GhostBuster Game Like This.
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.
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.
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.
Unit 1 Introduction to Evangel College S.2 ICT.
First Project: Dance Dance Sprite  Write a dance with your sprite (You pick or create the sprite)  Incorporate as many of the Motion Commands as you.
How to create a sprite Delete a sprite (e.g. the cat) by right clicking on it and choosing delete. Go to the bottom right hand corner and choose a new.
Using MIT Scratch for Programming and Control Exercise 4 – Cat and Dog game Year 9 ICT Autumn Term 2007.
 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.
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
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Review for Final June 13, 2016.
Introduction to 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.
Scratch for Interactivity
Introduction to Object-Oriented Programming
Learn… Create… Program
Learn… Create… Program
Scratch for Storytelling
Getting Started with Scratch
Image #1 Getting Started
Getting Started with Scratch
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Presentation transcript:

1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes  variables & state  interacting sprites & broadcasts  animation & game programming

2 Scratch Scratch is a simple environment for creating animations & games  developed at MIT to introduce programming & creative design  great for making programming and object-oriented concepts concrete sprite: an animation object with properties and behaviors by default, the Scratch cat sprite loads  can add properties and behaviors by dragging blocks from the left pane to the middle pane Scratch is free at scratch.mit.eduscratch.mit.edu Web site contains numerous guides & tutorials more than 500K projects uploaded & viewable Scratch is free at scratch.mit.eduscratch.mit.edu Web site contains numerous guides & tutorials more than 500K projects uploaded & viewable

3 Adding sprites can select from a provided collection of sprites  click on the button with star & folder  collections include animals, fantasy characters, people, things, … can create a new sprite using the Paint Editor  click on the button with star & paint brush  can draw, add shapes, fill, erase, rotate, resize, add text, …  can even import an image, then edit as desired (e.g., erase unwanted parts) can move sprites around the stage using the mouse, shrink or grow by right-clicking

Sprite motion each sprite can move around the stage  select the desired (blue) Motion block  drag that block to the Script panel for the sprite  click on that block to execute it note:  coordinates: center = (0,0) bottom-left = (-240, -180) top-right = (240, 180)  directions: 0 = up 90 = right 180 = down 270 = left  can control whether the sprite turns as it moves by selecting one of: 4

Sprite control the (yellow) Control blocks allow for repeated or conditional behavior  when blocks allow for behaviors to be triggered by events (click on green flag, press a key, click on sprite)  wait block causes execution to delay a set amount of time  forever block encloses other block(s) that are to be executed over and over, indefinitely  repeat block encloses other block(s) that are to be executed a set number of times 5

Sprite sensing other blocks allow the sprite to sense the environment and make comparisons 6

Changing costumes can create multiple costumes for a sprite  click on the Costumes tab  either: 1.click on Paint to draw a new costume 2.click on Import to load an image 3.click on Copy to make a copy of an existing costume, then Edit to modify it switch to costume and next costume from the (purple) Looks blocks change the sprite’s costume 7

Interacting sprites 8 can have multiple sprites active at once  can sense and react to each other  note use of sound when sprites collide -- can also record sounds (or even play music), but much slower!

Variables & state 9 the state of a sprite is its current set of properties (e.g., location, color, heading) can add new properties to a sprite’s state with variables  a variable is a name that refers to some value/property  create a variable by clicking on Make a Variable  by default, the variable is displayed on the stage  a sprite can access and update a variable using the set and change (orange) blocks

Die example suppose we want to develop an animation that involves dice (e.g., online casino)  could create a sprite that represents a die  has 6 costumes, corresponding to die faces  when clicked, flips through a random number of costumes why between 14 and 19? 10

Coordinating sprites if we want two dice, how do we coordinate them?  could pick a key, have both dice roll when that key is pressed  better solution: put a button on the stage & have both dice roll when the button is clicked  requires the button to broadcast a message when clicked & dice to react to that message 11

Counters if we want to keep track of the rolls, again need variables to maintain the state  create a variable for the number of dice rolls and the number of doubles obtained  every time the button is clicked, the number of rolls goes up by one  if doubles were rolled (i.e., the dice costumes are identical), the number of doubles goes up by one in general, a counter is a variable that keeps track of some event  initially, the counter value is 0 (nothing has happened yet)  each time the event occurs, the variable value goes up by one 12

Animations & games numerous projects are included with the Scratch download  more than 500,000 project uploaded to the scratch.mit.edu sitescratch.mit.edu  lots of animations stories with characters interacting (especially cats & anime) tutorials, dance & music, drawing, …  lots of games interactive video games (e.g., tetris, pacman, breakout) casino games, word games, stick figure movement, … recall: programming is the process of designing, writing, testing and debugging algorithms that can be carried out by a computer  Scratch is programming!  you design the sprites (objects), their properties & behaviors, their interactions  you create the scripts (algorithms) that implements those behaviors  you test and debug the projects to make them work as desired 13