August 25, 2015 by wendy
Have you noticed that games and apps often track information as you use them? This week, we’re diving into variables, which allow us to store and modify data within our programs.
Why, as computer programmers, do we want to store information? Do your students have any ideas? Brainstorm things that we want to track in our projects. For example, a game might want to store the player’s name, the number of lives left, or the number of coins collected. All of these things are kept as variables. Before starting coding, it is important to understand the feasibility of using calculations, numbers, formulas and coefficients. It is even recommended to have a manual or a short guide with the main terms, which for any student can prepare an economics essay writing service https://mid-terms.com/informative-economics-essay-writing/ quickly and informatively.
A variable is like a jar. We can store anything inside of it and we can give it a label so that we know what’s inside. For instance, a variable called score can contain a number that represents how many points the player has earned.
Let’s see what a variable looks like in Scratch! Create a new Scratch project and under the “Scripts” tab, click on “Data”. From there, click on the “Make a Variable” button. Make up a label for the variable next to “Variable Name” and click “OK”.
Did your students notice all the new blocks that were created? Drag the circular block with the variable name into the scripts area. Click on it to demonstrate that we can use it to see its value similar to the answer block that we used for our quizzes last lesson. Drag out the remaining variable blocks and click on each one to demonstrate what they do.
Challenge your students to incorporate variables into an existing project. Maybe they can use variables to keep score in their quiz games from last lesson. Can they also think of ways to use variables in their mazes or design projects?
The remainder of the lesson is time for your students to complete their design projects. For those who are finished, encourage them to find others to test their projects and fix any glitches or bugs that they might find.
August 12, 2015 by wendy
What makes a game? Is it characters? Is it story? Interactivity? In this week’s lesson, we explore common elements of games and how we can design and build our own games in Scratch.
We’ve covered a lot of concepts over the last 7 lessons, including events, loops, timing, and messaging. All of them are important to making games, but today’s concept might be the most important.
In small groups, give your students a few minutes to brainstorm their favourite games and have each group choose one favourite game. Then come together as a class and create a list of favourite games. Discuss what these games have in common. What makes them games?
Almost all games have rules. Provide an example of a rule, like if the player touches a coin, then the player collects 5 points. See if your students can come up with a list of rules following the same sentence structure.
After listing a few examples, explain that in video games, these rules are called conditionals. A conditional starts with the word if followed by a condition, something that can be true or false. It ends with the word then, which is followed by an action, what to do if the condition is true. Revisit your list of rules. See if your students can identify the conditions and actions.
There are different kinds of conditionals. The one we just covered is called if-then. There is another type of conditional called if-then-else. Can your students guess how it’s different?
If-then-else works just like if-then except it has an extra action after the word else that describes what to do if the condition is false. For example, if I’m feeling tired, then I’ll take a nap, else I’ll play outside. Can your students think of other if-then-else examples?
To gain more experience with conditionals, have your students remix a starter project that contains conditionals like our Maze Starter Project or Quiz Starter Project above. Each project has an example of how to use conditionals and a chance for students to try it themselves!
Once your students feel more comfortable with conditionals, encourage them to add conditionals to their design projects. At the end of the lesson, ask for a few volunteers to share how they incorporated conditionals into their projects.
August 3, 2015 by wendy
In Lesson 6, we saw how we can use timing and messaging to synchronize sprites. This week, we continue to investigate how we can coordinate sprites with backdrops!
Why might it be useful to be able to coordinate the stage, or backdrops, with sprites? Can your students think of some examples?
Suppose we want to add a start screen to one of our projects. Take, for example, the joke project that we made last week. We can remix the project so that when the start screen is clicked, the joke begins.
Show your students that they can add new backdrops by clicking on the Stage to the left of the Sprites area and selecting the Backdrops tab. The stage can have multiple backdrops just like sprites can have multiple costumes.
Click back to the Scripts tab. We can write code for the stage just like we can write code for sprites except that the stage has different code blocks. For example, the stage doesn’t have any motion blocks, but it does have looks blocks like “switch backdrop to…” and “next backdrop”.
Work together as a class or have your students work individually to add a start screen to an existing project. Choose any project or try our Knock Knock Joke with Start Screen project above that has notes for you to follow along! If your students worked individually, ask for a few volunteers to share their backdrops when they’re finished.
By adding timing, messaging, and backdrop changes, we’re adding a lot of complexity to our projects, which can also add glitches or bugs. Trying to fix these bugs can be frustrating. Here are some problem solving tips that you can share with your students:
For the rest of the class, your students can keep working on their design projects. Challenge them to incorporate multiple backdrops!