Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro CS – Costumes and Variables

Similar presentations


Presentation on theme: "Intro CS – Costumes and Variables"— Presentation transcript:

1 Intro CS – Costumes and Variables
Lesson Plan 6

2 Goals Understanding Costumes, Ordering, Naming
Switching Costumes with Switch and Next Using Variables to control state Changing costumes in a loop to animate a sprite Show and Hide Layering

3 Objectives Students are introduced to the topic and given examples of costumes, animation through loops, and showing/hiding sprites based on conditions Students are introduced to variables to store and retrieve information Students are given real problems to code and solve Results are demonstrated through demos of running code and displayed results

4 Pre Requisites Repeat loops
Basic Understanding of Scratch, Sprites, IF blocks

5 Materials Slides with examples (or present on whiteboard)
PCs with development environments installed

6 Lesson Description Students use variables to track sprite state, and animate sprites using costumes Students practice and extend examples to their own wishes, and create costume animations Students present their solutions, typically F2F with the instructor(s) at their desk Students analyze their and others’ solutions for bugs

7 Lesson Procedure Review last lessons: Repeat loops, IF blocks
Intro/examples of multiple costumes to show animation within a sprite Using Next Costume to cycle through costumes Setting a costume by name Using variables to control speed of animation, applied color and graphics effects Give exercises for in class practice (create their name with multiple sprites for each letter), and animate the sprites both through costumes and with movement (wiggle in place, slide across the screen, etc.) Walk the room answering questions, looking over the shoulder, asking questions, etc.

8 Closure/Conclusion Discussion Summary
How can you use costumes for your Galaga enemy ships or Defender ship? How can you use variables in your Galaga project? Track/show score Enemy lives Defender hits before death Power ups Summary Costumes are an easy way to make better looking programs Variables are powerful for storing information for later use Decisions/IF statements based on variables (bonus lives after score reaches a certain point?) Storing information for later use Tracking state Ask questions on what is confusing or needs more time/practice

9 Costumes and Variables
Lesson Plan 6 Review what we learned in the last lecture: mainly how to have a sprite bounce off walls and other sprites using if decision blocks. Also review how to change the sprites on touch/bounce. Ask if there were any difficulties. What the kids thought was interesting.

10 Example Demo Today we will learn about variables and costumes, using these concepts and ones we have already learned we will create an animated billboard with our names (or whatever appropriate word or collection of sprites that you wish). Demo – Name animation Show them the cool game they will be creating today :D

11 Costume What is a costume? What can we use costumes for?
Costumes are an attribute, characteristic, or property of a sprite that helps change the look of the sprite. What can we use costumes for? Change the action of a sprite Turn a sprite into something completely new Change the background First ask the kids, a raise of hands who have used costumes before. Review that we used costumes to make the cat/other sprite in our first daily project seem like he was walking. Ask what other cool things we can do with costumes. For example: making it look like a sprite is dancing, or changes their expression. We also use costumes to change the background. Make sure to demo how to switch and do next costume.

12 Costume What do these costume blocks do? Switch the costume to #2
Switch the costume to the next one Variable costume number What are the different costume blocks?

13 Variable What is a variable?
Stores a value that can be reused in code. Pros: if you want to change a number, you will only have to change it in one place. Example how to create a variable and use it. Ask students who has used a variable so far. What is a variable? Ask how many students have found it annoying that every time they need to change a number in many different places they need to go one by one and change them. Wouldn’t it be nice if we only had to change the number once? Since we are lazy, CS has a perfect solution for this, and it’s called a variable. Then give an example in Scratch how to create a variable, show some of the cool things you can do: show/hide variable. Show how to set variables, ideally in the background code

14 Example Demo Demo of variable use (ballerina and animated name)
Show how to create the project – where the variables go, how to use them. Builds upon already known pieces.

15 File format: LP6-YourLastName_YourFirstName.sb
Daily project By the next class: create an animated billboard. Worth 10 points total. Save your project: File format: LP6-YourLastName_YourFirstName.sb Grade Breakdown – Must Include Points Sprite initial positions are set in code 1 Contains at least 4 sprites 2 Contains at least 3 costumes per sprite Contains 2 variables to control the animation in 2 different ways Sprites animate through the costumes Sprites move and/or change effects Extra ideas if you want more challenges: Use mouse or keyboard to trigger animation Have one letter follow the mouse, and each letter follow the one in front of it Use ghost effects to create fade-in movie banners

16 Extra activity Use a variable to keep track of the score in a mini-game you create. Add and remove from the variable when appropriate Show the score during the game


Download ppt "Intro CS – Costumes and Variables"

Similar presentations


Ads by Google