Events from interaction in game
<p>I am attempting to make a game as part of learning Java. I don't want to hardcode levels, so I have a 'level' object which stores a map and data about the level. Parts of the map should be able to be interacted with, though - I can define those parts pretty easily, but I'm not sure how to actually do the interaction.</p>

<p>If I were coding this in Python, I would probably have a dictionary of eventname:function pairs, and then simply return the eventname associated with an interactive level part, then execute the applicable function. But I don't know how to do the same sort of thing in Java.</p>

<p>How should I do this?</p>

<p>(I'm not sure this is entirely clear... I tried to make it as clear as possible, but if it is unclear I'm happy to attempt another explanation)</p>
