earwax.event_matcher module¶
Provides the EventMatcher class.
-
class
earwax.event_matcher.
EventMatcher
(game: Game, name: str)¶ Bases:
object
Matches events for
Game
instances.An object to call events on a
Game
instance’slevel
property.Used to prevent us writing loads of events out.
Variables: - game – The game this matcher is bound to.
- name – The name of the event this matcher uses.
-
dispatch
(*args, **kwargs) → None¶ Dispatch this event.
Find the appropriate event on game.level, if game.level is not None.
If
self.game.level
doesn’t have an event of the proper name, search instead onself.game
.Parameters: - args – The positional arguments to pass to any event that is found.
- kwargs – The keyword arguments to pass to any event that is found.