Learning Objectives

In our quest, we now can talk to a non-player character and trigger objects we want to appear. Our next goal is to make it so when we run into those objects, we can collect them. To do this, we are going to go back to the events tutorial and create a Collision Listener 2D or Collision Listener 3D. Note that collision is a complicated topic in computer science. We could write our own code, but letting Quorum handle collisions for us is easier and faster.

You will:

  1. Learn about Collision Listeners
  2. Learn about Collision Events
  3. Learn about Accessibility in Games

What is a Collision Listener? (10 minutes)

In a computer, hypothetically, we can imagine several ways in which we could handle collisions. One way would be to check every single item in the scene and see if their coordinates overlap. This works! Unfortunately, it turns out it is also slow, which would make a game less responsive in real-time.

While the details are outside the scope of this tutorial, one common approach in games is thus to ask the game engine to handle all the tricky math related to making collisions faster. Collision listeners are thus asking Quorum to decide on its own if any objects it cares about are colliding and to let our game know if it happens. This triggers an event, just like with the keyboard or the mouse.

Activity (40 minutes)

In the Events tutorial, go to the section labeled 'Detecting Collisions with Events' and skim it over. Our goal is to figure out the following: 1) how to make our game a collision listener, just like we did with the keyboard listener, 2) how to register our collision listener with the game, which tells it to start sending us events, and 3) how to create an action called BeginCollision and use it to capture the collision events. Use an output statement to have your game inform us when a collision occurs.

Wrap-up (10 minutes)

We will do one more accessibility discussion related to collisions. Notably, in our game we now have a character that needs to find our objects. In your groups, discuss different ways that we could make this finding process accessible. Like before, consider the difficulty of the task, and the actions the user would have to take, now for each of the following groups:

  1. Visual Disabilities
  2. Hearing Disabilities
  3. Physical Disabilities
  4. Learning Disabilities

Next Tutorial

In the next tutorial, we will discuss Trigger Sound from Objects, which describes trigger sounds on objects..