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.

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.
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)
Scratch for Storytelling Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
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.
1 An intro to programming concepts with Scratch Session 3 of 10 sessions Repetition and variations.
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.
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 7 of 10 sessions Working with sounds and sprite communication.
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)
1 An intro to programming concepts with Scratch Session 1 of 10 sessions Looks and Motion.
ITEC Winter An intro to programming concepts with Scratch Quick intro for college citizens. George Stockman MSU CSE.
Madlib-Input, Strings, and Lists in Scratch Barb Ericson Georgia Tech June 2011.
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.
2012 CSE-BEACON camp1 Computer Science Concepts 1. What is an algorithm? 2. Binary information coding 3. Programming concepts via Scratch Designed for.
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!
ACO 101 Making a program. mb_your_brain_on_improv.html mb_your_brain_on_improv.html.
2012 CSE-BEACON camp1 Computer Science Concepts 1. What is an algorithm? 2. Binary information coding 3. Programming concepts via Scratch Designed for.
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.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
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.
Setting up your computer’s microphone Begin by double clicking on the volume icon within the task bar.
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.
By: Susan Freeman Getting Started 1.Go to Start Programs Microsoft PowerPoint.
Computer Programming Modeling a Passive Solar Home.
24 Background Building 25 Computing Terminology, and Speed/Velocity Module 4 Notes: Sensing, Or Operator, Conditional Logic 28 Module 4 Algorithms,
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.
Madlib-Input, Strings, and Lists in Scratch Barb Ericson Georgia Tech.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Spanish Mad libs with Scratch
Unit 2 Getting Started With
Scratch I - Overview.
Scratch for Interactivity
Introduction to Object-Oriented Programming
Learn… Create… Program
Learn… Create… Program
An intro to programming concepts with Scratch
Go to =>
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Presentation transcript:

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 for actor (object). Instruction menus/panel at left (instructions for the actors) A script is another name for program or method; a script tells the actor what to do. Programming panel in center; here is where we construct scripts for the sprites (Sprites are objects; their scripts are methods or behaviors.)

3 Scratch and OOP

4 The WAIT instruction is needed to slow down the acting so we can see or hear it properly (computers are too fast sometimes) Get the wait instruction from the CONTROL menu. Please ignore the other menu options at this time. Insert a wait in our looks script

5 3 second pause between changing color and size

6 The MOTION menu How to locate and orient a sprite; position and angle; moving a sprite

7 Position on the stage Using the Looks menu, shrink our cat to 25%. Click on the Motion menu. Click to check the box for x- position and y- position Drag your cat around and note its x-y position.

8 Other instructions goto x,y glide to x,y Move N steps Set direction

9 The “glide-to” instruction Drag the “glide-to” instruction into your script panel. Edit in some coordinate values and double click to see where your sprites goes.

10 The SENSING menu Getting information from the user or some other machine

11 Use the SENSING menu 1)Ask the user for age; 2) user types in age; 3) result stored in “answer”

12 User types “13” and the script stores the answer “answer” is a Special Scratch variable

13 OUTPUT: Giving the user information with say answer Say is in Looks menu; drag “answer” from Sensing menu; click

14 Making an “age variable” 1)Click Variables menu; 2) click “Make a variable” 3)Type in “age” and click OK Do you want to display for all sprites or just one?

15 We have an “age variable” Displaying variable “age” Operations for “age”

16 We can join text and a number to say things Build this instruction from the parts above it. From Looks From Operators From Sensing Make the join

17 Storing a value in a variable; then saying it to the user 1)Set from Variables menu; 2) Say from Looks menu; 3) Join from the Operators menu joins your text with the “answer”

18 The variable V now stores the computed average of A and B

19 Changing costumes Another way to change the appea rance of a sprite.

20 Making a new costume 1)Get bat2-a sprite from the “sprite box”. 2)Click on sprite 3)Click on “Costumes” 4)Click on “Import” 5)Now get bat-2b sprite from the sprite box

21 Use a loop to make the bat fly! 1) When and repeat from Control menu and 2) next costume from Looks menu.

22 Changing coordinates We can randomly set the location of the bat so it will “flutter”. Set X to a random number Set Y to a random number Move the bat to location (X,Y) Of course, the bat should remain on stage!

23 Using pick random Click the stop sign at the stage upper right to stop the forever loop. Do we need a wait in the loop? Try it to see the change in flying.

24 Multiple interactive bat flight

25 Adding a background Click on the Stage icon at lower right Click on Backgrounds Click on bat icon (Sprite1) Click on Scripts FLY AGAIN!

26 Controlling the bat’s direction Let’s create multiple scripts. Click space bar for random moves Click right arrow to move right Click left arrow to move left The bat will behave differently depending upon which key is typed! (So, could a gamer catch the bat?)

27 Composing with drum beats

28

29 Jodi jumps on the drum Story teller script Jodi’s script

30 Recording from a mike (or an iPod or other music player) 1. Plug in microphone 2. Pick the speaker sprite 3. Click “Sounds” 4. Click “Record” 5. Click red button and speak 6. Click square button to stop 7. Click triangle to hear it 8. Click “OK” if it’s OK 9. Use name of sound in a play-sound instruction