I'm working on a 2D tile based game in which the player interacts with other game objects (chests, AI, Doors, Houses etc...). The entire map will be stored in a file which I can read. When loading the tilemap, it will find any tile with the ID that represents a gameobject and store it in a hashmap (right data structure I think?).
private static HashMap<Integer, Class<GameObject>> gameObjects = new HashMap<Integer, Class<GameObject>>();
How exactly would I go about calling, and checking for events? I figure that I would just call the update, render and input methods of each gameobject using the hashmap.
Should I got towards a Minecraft/Bukkit approach (sorry only example I can think of), where the user registers an event, and it gets called whenever that event happens.
Or should I just loop through the entire hashmap looking for an event that fits?
I'm using Java and LWJGL.