Hello! My name is Jordan, and I come from the Lakota and Nez Perce tribes. I’m also part Hopi and Mojave, and I work at Pinterest leading a team called Global Outsourcing. Today, we’re going to learn how to make your Sprite Lab projects more interactive and fun!
In Sprite Lab, you can make your program respond when someone interacts with it. This is done using something called events. An event is like a signal that tells your program to pay attention and do something when a specific action happens.
Some examples of events are when you click the mouse, press an arrow key, or tap on the screen. In Sprite Lab, you use special blocks called event blocks to make these things happen. For instance, blocks like “when key pressed” or “at seconds” are event blocks. When the action they are listening for occurs, the code connected to them runs.
Let’s say you have a sprite that wobbles. You can add another block to make it do something new after a few seconds. For example, you can use an event block to make your sprite start a new action after a certain time has passed.
You can also make your sprite change size when you press the up arrow key. By using the “when up arrow pressed” block, you can make your sprite grow bigger each time you press the key.
It’s important to know that event blocks don’t connect directly to your main program. Instead, they create their own little programs. This means that once a behavior starts, it will keep going until you tell it to stop. If you don’t want different events to mix their actions, you can use a stop block to control them.
There are many other events you can use to make your projects exciting. For example, you can make something happen when two sprites touch each other on the screen or when a user clicks on a sprite. By using events, you can create amazing programs and interactive worlds. So go ahead and give it a try!
Events are a powerful tool in Sprite Lab that allow you to make your projects interactive and engaging. By understanding how to use event blocks, you can create fun and imaginative programs. Have fun experimenting with different events and see what you can create!
Think of an action you want your sprite to perform when a specific event occurs, like pressing a key or clicking the mouse. Use the event blocks in Sprite Lab to program this action. Share your creation with the class and explain how the event triggers your sprite’s behavior.
Use the “when up arrow pressed” block to make your sprite grow bigger each time you press the key. Experiment with different sizes and see how big you can make your sprite before it disappears off the screen!
Create a short story using sprites and event blocks. Each event should trigger a new part of your story. Present your story to the class and describe how each event contributes to the plot.
Design a simple game where sprites interact with each other using events. For example, make a sprite disappear when it touches another sprite. Test your game with a classmate and see who can score the most points!
Explore different event blocks in Sprite Lab and try to use at least three different types in a single project. Share your project with the class and discuss how each event block affects your sprites.
Here’s a sanitized version of the transcript:
—
My name is Jordan, and I am of Lakota and Nez Perce descent. I am also Hopi and Mojave, and I lead a team called Global Outsourcing at Pinterest. Now that you’ve learned how to use Sprite Lab, you’re going to want to make your program react when someone interacts with it. To do that, you’ll use events. An event tells your program to listen for something to happen and then react immediately.
Some examples of events include listening for a mouse click, an arrow button press, or a tap on the screen. Blocks like “when key pressed” and “at seconds” are known as event blocks. The code connected to an event block runs when the appropriate action is detected.
For example, here’s a program I started with a wobbling sprite. If I attach another “sprite begins” block to the app’s seconds event, my sprite can begin a new behavior after a certain number of seconds have passed. I can also use actions like the change block with events like the “when up arrow pressed” block. Now, each time the user presses the up arrow, my sprite gets bigger.
Notice that event blocks don’t snap into your main program; instead, they create separate little programs of their own. Remember that behaviors continue until you tell them to stop. If you don’t want multiple events to combine behaviors, you’ll need to use one of the stop blocks.
Other events you learn will allow you to make different things happen when two sprites touch on the screen or when the user clicks a sprite. By using events, you can create imaginative programs and interactive worlds. Give it a try!
—
This version maintains the original content while removing any unnecessary details or informal language.
Sprite – A character or object in a computer program that can be moved or changed. – In our game, the sprite is a cat that can jump over obstacles.
Lab – A place or environment where experiments and coding projects are done. – We went to the computer lab to work on our coding assignments.
Events – Actions or occurrences that a program can respond to, like clicking a button. – The game starts when the ‘start’ button event is triggered.
Program – A set of instructions that a computer follows to perform a task. – We wrote a program to make the robot move in a square.
Block – A piece of code that performs a specific function, often used in visual programming languages. – We used a loop block to repeat the actions in our animation.
Interactive – Allowing a user to interact with a program or game. – The interactive story lets you choose what happens next.
Action – Something that happens in a program, often as a result of an event. – Pressing the spacebar causes the action of the sprite jumping.
Mouse – A device used to move a pointer on the screen and interact with the computer. – We used the mouse to drag and drop blocks in our coding project.
Key – A button on the keyboard that can be pressed to input data or control a program. – Pressing the ‘up’ key makes the character move forward in the game.
Control – Commands that manage the flow of a program, like loops and conditionals. – We used control blocks to make decisions in our game based on player input.