cremalab/holidays-game — pull request #35 by albatrocity (2014-12-13 21:28:17+00:00)
Title: Actionable items

Adding ability to trigger events when pressing keys within proximity of obstructions. Define a `keys` object within the `proximity` object of an obstruction.

```coffee
id: "fridge"
src: "images/fridge.png"
x: 1125
y: 50
proximity:
radius: 60
keys:
action: ->
EventBroker.publishEvent 'reactor:act', 'team_photo'
```

For simplicity's sake, the keys are predefined. "action" is spacebar, and the callback is fired if the current player is within proximity of the item.

This also adds the `Reactor`, which is basically just an event handler class. Check the `lib/actions.coffee` file for a list of actions by ID.