Learning Objectives

Now that we have learned how to get information from a running scene, we now move to user input. Input in this context means largely from the keyboard or the mouse and in this lesson we focus on the keyboard.

You will:

  1. Learn about KeyboardListeners
  2. Learn about Keyboard Events
  3. Learn how to code user input

Concepts of Keyboard Listeners and Keyboard Events (10 minutes)

Computers have to be told to process user input. In most programming languages, including Quorum, this process involves Keyboard Events and Keyboard Listeners. In this section, we will discuss these ideas broadly.

Create a Keyboard Listener and Listen for Events (40 minutes)

Next, we will program our KeyboardListener and respond to the events. Specifically, in the next 40 minutes, we will learn how to tell our game to listen for these events, register our game as a listener, and output the key that was pressed by the user. Keys use special codes to indicate what the user was pressing. These are generally not memorized by anyone and, as such, we will demonstrate how to look them up as they are needed.

Wrap-up (10 minutes)

For this wrap-up, we are going to have online discussions about the concepts in this lesson. Each group in their breakout should try to answer the following questions: 1) What does it mean to register a Keyboard Listener, 2) What is a Keyboard event and what kind of information can we obtain from them, and 3) Imagine we want to get input from the mouse instead. How do we imagine a MouseListener might work?

Next Tutorial

In the next tutorial, we will discuss Moving My Character, which describes move a character in a running game..