CSC 221: Introduction to Programming Fall 2018

Slides:



Advertisements
Similar presentations
Sprite-visual object (actor on the stage) Scripts- Tells actors (sprites) what to do.
Advertisements

Create a Simple Game in Scratch
Create a Simple Game in Scratch
Scratch is a Visual Programming Language
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.
Extending the Pong Example Barb Ericson Georgia Tech June 2011.
Digital Art in Scratch part 1 Barb Ericson Georgia Tech Oct 2010.
Scratch Workshop Thursday, August 26, 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.
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!
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.
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.
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.
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.
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.
Using MIT Scratch for Programming and Control Exercise 1 Creating movement Year 11 DTG 2012.
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.
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.
Computer Programming with Scratch JAOIT 8. Scratch Scratch is a programming language that makes it easy to create your own interactive stories, animations,
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.
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
Scratch Programming Intro
Learn… Create… Program
Learn… Create… Program
Scratch for Storytelling
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
Lesson Nine Variables.
Scratch – Simple Programming
Presentation transcript:

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

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 middle pane to the right pane Scratch is free & online at scratch.mit.edu Web site contains numerous guides & tutorials more than 38 million projects online you can download to/upload from your computer, or create a free account and store projects online

Adding sprites can select from a provided collection of sprites click on the cartoon character next to New Sprite: collections include animals, fantasy characters, people, things, … can create a new sprite using the Paint Editor click on the 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 note: 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 using the "set rotation style" block

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

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

Changing costumes can create multiple costumes for a sprite click on the Costumes tab either: click on brush to draw a new costume click on file to load an image right click on an existing costume to make a duplicate, then edit switch to costume and next costume from the (purple) Looks blocks change the sprite’s costume

Interacting sprites 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 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

Counters 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 it is VERY important that the initialization happens OUTSIDE the loop -- WHY?

New game we want to repurpose the stick prof and baseball into a game the stick prof is controlled by the mouse by moving the mouse, the user can move the stick prof left and right the baseball drops out of the sky from a random location the user must move the stick prof so that the ball lands in the glove if caught, the player's score goes up and a new ball drops if missed, then the game ends would like to make it easy to start and restart the game when the green flag is clicked, the stick prof is positioned & instructions displayed when the user hits space bar, then balls start dropping when the game ends, a message is displayed and the space bar restarts

Ball drop game it makes sense for the stick prof to handle the start and end of the game but the baseball knows when it hits the ground how do they communicate and coordinate? one sprite can broadcast a message when an event occurs (e.g., ball hits the ground) another sprite can receive the broadcast and react

Ball drop game note: there is only one ball when it is caught, it reappears at the top at a new position when it hits the ground, it broadcasts the "Game Over" message and stops the script what if we changed the number?

Animations & games numerous projects are included with the Scratch download more than 38 million projects uploaded to the scratch.mit.edu site 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