EGN-1002 Circuit analysis Module Introduction to Scratch Slide: 1
Intro to visual programming environment Intro to programming with multimedia Story-telling, music-making, game-making Intro to programming concepts: objects, attributes, sequence, repetition, conditions, events, I/O Slide: 2
What is Scratch Scratch is a free programmable toolkit that enables users to create their own games, animated stories, and interactive art and share their creations with one another over the Internet. Use of scratch allows you to: Create solutions to problems using computers Study information Invent algorithms Write programs to implement the algorithms Reuse a lot of existing program and machine parts Slide: 3
Start Scratch Open web browser Navigate to: http://scratch.mit.edu Slide: 4
Scratch start window Stage area This is where the result of your program execution will be seen Sprite list Blocks palette Scripts area Your construct your script here by putting together command blocks from the Blocks palette. List of existing or created objects which are used in your script. Slide: 5
What Scratch can do Can make cartoons Can create stories Can create video games Elements of Scratch: objects Colors Sounds Locations in 2D space Sprites Costumes Variables (to remember the state of things) Events: that are broadcast for communication Slide: 6
Your first script Make sure to have a sprite selected in the Sprite list Drag shown blocks into Script area. Click the sprite in the Stage area Slide: 7
Add new stage Slide: 8
Stage dimensions These are x- and y- coordinates for the stage: x = -240 y = 180 y x = 240 y = 180 x = 0 y = 0 x x = -240 y = -180 x = 240 y = -180 Slide: 9
Add new sprite Slide: 10
Loop constructs in Scratch Repeat N times Repeat forever Repeat forever if some condition exists Slide: 11
Compose program in Scratch Slide: 12
Compose scripts in Scratch Examples of loops and IF operators: Slide: 13
Scratch assignment No. 1 Using Scratch (scratch.mit.edu) design algorithm and script which would perform the following: 1. Draw a car. 2. Draw a smiley face. 3. Draw a house. 4. Draw a sailboat. 5. Draw initials of the team leader. 6. Draw a robot face 7. Draw a 6-leaf flower 8. Draw 5 squares with crosses Save your script on your local computer. Prepare brief printed MS-Word report with problem statement, solution description, working script, and Scratch screen shots. Upload the script and the report to your group file exchange section on the BlackBoard. Each team should be able to present (show on the screen) and explain working scripts to the audience in class. The printed report shall be turned in. Slide: 14
Scratch assignment No. 2 Using Scratch (scratch.mit.edu) design algorithm and script which would display: 1. working digital clock 2. working analog clock 3. stop watch Create your own sprites and your own background if needed. Save your script on your local computer. Prepare brief printed MS-Word report with problem statement, solution description, working script, and Scratch screen shots. Upload the script and the report to your group file exchange section on the BlackBoard. Each team should be able to present (show on the screen) and explain working scripts to the audience in class. The printed report shall be turned in. Slide: 15
Scratch assignment No. 3 Using Scratch (scratch.mit.edu) design algorithm and script which would draw a graph of function: f(x) = A sin(ax + b) where A, a, and b are parameters which can be entered from keyboard. Create your own sprites and your own background if needed. Save your script on your local computer. Prepare brief printed MS-Word report with problem statement, solution description, working script, and Scratch screen shots. Upload the script and the report to your group file exchange section on the BlackBoard. Each team should be able to present (show on the screen) and explain working scripts to the audience in class. The printed report shall be turned in. Slide: 16
Scratch assignment No. 5 Using Scratch (scratch.mit.edu) design algorithm and script which would perform the following functions: 1. Rotate the vehicle with an arm until it finds (touches) the object 2. Grab the object 3. Rotate the vehicle with the object 180 degrees 4. Release the object 5. Move the vehicle off the object Create your own sprite and your own background. vehicle object Save your script on your local computer. Prepare brief printed MS-Word report with problem statement, solution description, working script, and Scratch screen shots. Upload the script and the report to your group file exchange section on the BlackBoard. Each team should be able to present (show on the screen) and explain working scripts to the audience in class. The printed report shall be turned in. Slide: 17
Scratch assignment No. 6 Using Scratch (scratch.mit.edu) design an algorithm and a script which would move chosen sprite (a ball) in random direction inside a rectangular box and bouncing off its walls. You may create your own sprites and your own background. Save your script on your local computer. Prepare brief printed MS-Word report with problem statement, solution description, working script, and Scratch screen shots. Upload the script and the report to your group file exchange section on the BlackBoard. Each team should be able to present (show on the screen) and explain working scripts to the audience in class. The printed report shall be turned in. Slide: 18
Scratch assignment No. 7 Using Scratch (scratch.mit.edu) design an algorithm and a script which would animate your team name. Maximum length 30 seconds. Your scene needs to have theme music and a stage that reflects your personality, interests, and essence. Include suitable animation for the letters. You may create your own sprites and your own background. Save your script on your local computer. Prepare brief printed MS-Word report with problem statement, solution description, working script, and Scratch screen shots. Upload the script and the report to your group file exchange section on the BlackBoard. Each team should be able to present (show on the screen) and explain working scripts to the audience in class. The printed report shall be turned in. Slide: 19