Skip to content
Ong Ming Yang edited this page Aug 10, 2014 · 1 revision

The Interactor Class

The Interactor is responsible for taking care of all interactions with the surrounding objects. Each time the player object moves to a new tile, the Interactor computes the adjacent tiles that are interactable, and binds event listeners to the window. Upon clicking on the target, the Interactor runs the target's interaction function, and increments the target's interaction count.

Adding interactions to targets

Interactions are added to targets through the onInteract handler in the Map class. The handler accepts a vertex id and an interaction function and binds this to the object. It also sets some flags so that the target is rendered as its own geometry in the map optimization process.

Foo

Clone this wiki locally