Star Wars – Hour of Code: Events

Alphabets Sounds Video

share us on:

In this lesson, Sharita Carter introduces the concept of events in programming, which are signals that trigger specific actions in response to user inputs, such as key presses. Students learn how to implement events to control the movements of R2-D2 in a game, using commands that respond to the up and down arrow keys. By understanding and utilizing events, learners can create more interactive and engaging gaming experiences.

Star Wars – Hour of Code: Events

Hello! My name is Sharita Carter, and I work as a senior creative producer at Walt Disney Imagineering. My job is to lead teams that create amazing attractions for our guests. We always try to make these experiences better and more exciting, and technology plays a big part in that.

Great job on programming BB-8! Now, let’s take on a new challenge. We’re going to travel back in time and create a game featuring R2-D2 and C-3PO. To do this, we need to learn about something important that game programmers use all the time: events.

What Are Events?

Events are like signals that tell your program to wait for something to happen. When that thing happens, the program does a specific action. For example, events can be listening for a mouse click, an arrow key press, or a tap on the screen.

Making R2-D2 Move

In our game, we want R2-D2 to move up to deliver a message to a pilot and then move down to another pilot. We’ll use events to make him move when the player presses the up and down arrow keys.

Using the “When Up” Event

First, we use a block called “when up.” We attach a “go up” block to it. This means that when the player presses the up arrow key, R2-D2 will move up. It’s like giving R2-D2 a command to follow when he hears the signal.

Using the “When Down” Event

Next, we do the same for moving down. We use a command called “when down.” When you drag this command out, you’ll notice it has curly brackets. These brackets are like a container where we can put other commands. Every command inside these brackets will run when the player presses the down arrow key.

So, to make R2-D2 go down, we put a “go down” block inside the “when down” command. This way, R2-D2 will react to the button presses and move around the screen, making your game more interactive!

Conclusion

By using events, you can make your game characters respond to player actions, making the game more fun and engaging. Keep experimenting with different events and see what cool things you can create!

  1. How does Sharita Carter’s role as a senior creative producer at Walt Disney Imagineering influence the way technology is integrated into attractions?
  2. Reflect on your experience programming BB-8. What challenges did you face, and how did you overcome them?
  3. In your own words, explain the concept of events in programming. How do they enhance the interactivity of a game?
  4. Describe a situation in a game or application where using events could significantly improve user experience. What specific events would you implement?
  5. Consider the process of making R2-D2 move using events. What did you learn about the importance of sequencing and logic in programming?
  6. How might the skills learned from programming R2-D2 and C-3PO be applied to other areas of technology or creative projects?
  7. What are some other examples of events you might encounter in everyday technology, and how do they impact user interaction?
  8. After experimenting with different events, what new ideas do you have for creating interactive experiences in games or other digital platforms?
  1. Interactive Coding Challenge

    Try creating a simple game where you program R2-D2 to move around the screen using the arrow keys. Use the “when up” and “when down” events to control his movements. Experiment with adding more events to make the game even more interactive!

  2. Event Exploration Activity

    Work in pairs to brainstorm different events you can use in a game. Think about what actions could trigger these events, like mouse clicks or key presses. Share your ideas with the class and discuss how these events could make a game more engaging.

  3. Design Your Own Game

    Imagine a new game featuring your favorite Star Wars characters. Plan out how you would use events to make the characters move and interact. Draw a storyboard of your game and explain the events you would use to a classmate.

  4. Event Coding Relay

    In groups, take turns adding code blocks to a shared project. Each student adds an event and a corresponding action for R2-D2 or another character. Pass the project to the next student to add their event. See how many events you can include in your game!

  5. Event-Based Storytelling

    Create a short story where events play a key role in the plot. Write about how characters respond to different signals or actions, just like in a game. Share your story with the class and discuss how events drive the narrative.

Sure! Here’s a sanitized version of the transcript:

Hello, my name is Sharita Carter. I am a senior creative producer here at Walt Disney Imagineering. I’m responsible for leading teams that produce the attractions that our guests get to experience. We are always looking for ways to improve and enhance the experience for our guests, and technology is at the heart of that.

Congratulations! You programmed BB-8. Now, I think we’re ready for something more challenging. Let’s go for it! Now that you’ve learned the basics of programming, we’re going to go back in time to build your own game starring R2-D2 and C-3PO.

To create a game, we need to learn about something that game programmers use every day, called events. Events tell your program to listen or wait for something to happen, and then, when it does, it performs an action. Some examples of events include listening for a mouse click, an arrow button, or a tap on the screen.

Here, we’re going to make R2-D2 move up to deliver a message to a Rubel pilot and then move down to the other Rubel pilot. We’ll use events to make him move when the player uses the up and down arrow keys or buttons. We use the “when up” event block and attach the “go up” block to it. When the player presses the up arrow key, the code attached to the “when up” block is executed.

We’ll do the same thing to make R2-D2 move down. To do this, we’ll use a command called “when down.” When you drag the command out of the toolbox, you’ll see that it starts and ends with curly brackets instead of a semicolon. This gives us space to put other commands in the middle. Every command we place in these brackets will run when the player presses the up arrow.

We want R2-D2 to go up, so let’s put a “go up” block inside the command, and we’ll do the same thing to make R2-D2 go down. Instead of writing all the code to control our Droid in advance, we can let R2-D2 react to button press events that move him around the screen step by step. Your game is getting more interactive!

[Music]

This version maintains the original content while removing any informal language and ensuring clarity.

EventsActions or occurrences that happen in a computer program, often triggered by the user or another part of the program. – When you press a key on the keyboard, it creates an event that the computer can respond to.

ProgrammingThe process of creating instructions for a computer to follow, using a specific language. – We learned programming by writing simple code to make a robot move forward.

GameA software application designed for entertainment, often involving challenges or puzzles. – We created a simple game in class where you have to catch falling apples with a basket.

MoveTo change the position of an object on the screen, often using code. – In our coding project, we programmed the character to move left and right using the arrow keys.

SignalA message sent to a computer or device to perform a specific action. – The remote control sends a signal to the TV to change the channel.

CommandAn instruction given to a computer to perform a specific task. – We used a command to make the turtle draw a square on the screen.

InteractiveAllowing a user to engage and participate actively with a computer program. – The interactive story we coded lets you choose what happens next by clicking on different options.

MouseA device used to control the movement of a pointer on the computer screen. – I used the mouse to drag and drop the blocks into the correct order in the coding puzzle.

ClickPressing a button on a mouse to select or interact with something on the screen. – To start the game, click on the green flag at the top of the screen.

ScreenThe display area of a computer or device where information and programs are shown. – We watched the animation play on the screen after we finished coding it.

All Video Lessons

Login your account

Please login your account to get started.

Don't have an account?

Register your account

Please sign up your account to get started.

Already have an account?