Tutorial 1: Input Mapping and Feedback

Unit 5 · Input, UI, and game feel

Objectives

Do not make gameplay depend directly on a particular key. Map keys, buttons, or touch gestures to actions such as MOVE_LEFT or JUMP. This supports rebinding, testing, and accessibility.

if (input.isPressed(Action.JUMP) && player.isGrounded()) {
    player.jump();
}
if (input.isHeld(Action.MOVE_RIGHT)) {
    player.moveRight(deltaSeconds);
}

A responsive action gives feedback quickly and consistently. Pair a hit with sound, animation, particles, screen-space UI, or a short camera response, but keep feedback readable and avoid effects that obscure important information.

Exercises

  1. Create an action map for keyboard and controller input.
  2. Explain the difference between pressed and held for jumping.
  3. Design feedback for collecting an item and taking damage.

Self-check

  1. Why map actions instead of checking keys everywhere?
  2. Which input state is suited to a one-time jump?
  3. What makes feedback useful?

Self-Check Quiz

1. What is an action map?

AnswerIt translates device-specific inputs into named game actions.

2. Why should jump usually respond to a press rather than a hold?

AnswerA press represents one intentional trigger and prevents repeated jumps every frame while the button remains down.

Homework

  1. Implement a rebindable action map for movement, jump, pause, and interact.
  2. Prototype feedback for two successful and two unsuccessful actions.
  3. Evaluate your UI for color-only communication and propose an accessible alternative.
Sample answerA robust design names actions independently of devices, distinguishes press from hold, and supplies at least two feedback channels for important events. For example, damage can change a health bar and play a sound while also briefly flashing the avatar; color should be paired with shape, text, or motion.
👤