Interactions are now a thing.
pkmn.swf-0.0.3 (58.7 KB)
I’ve set up interactable objects with the use of an interface. Additionally, I’ve set up Ogmo to play nice with the project.
As you can see, NPCs are a different object than the basic interactions. The DialogueNPC
class extends the Actor
class, which handles drawing the sprite, movement and collision. The Interaction
class extends Entity
and does not move or have a graphic.
Both DialogueNPC
and Interaction
implement IInteractable
, allowing me to do a single collision check when the player presses a button. If the player would interact with an IInteractable
, each of the two classes handle their own interactions. In the case of the DialogueNPC
, he faces the player and dialogue begins. In the case of the Interaction
, the dialogue is the only thing that happens.
I also have stubbed out an interface, ITouchable
, for objects which are touched (like doors, stairs, tall grass and healing pads). I think those are really the only two kinds of interactions in the game. I’m not counting trainers spotting you, since that isn’t a player interaction and will probably be handled by a component-based AI system on a per-actor basis.