Skip to content
William Edwards edited this page Aug 17, 2016 · 3 revisions

Game Engine Events

Game engine events are used by the Tuxemon game engine to handle some high level input operations. Currently, just keyboard input is implemented, but in the future more uses can be used.

Game Engine Events (GME) are used like pygame events, and are found in the pygame event queue. To test for them in a game state, follow the sample code below:

from core import state
from core.components.game_event import GAME_EVENT, INPUT_EVENT


class SomeState(state.State):

   def process_event(self, event):

      # Handle text input events.
      # The INPUT_EVENT is used after a player has used the input state.
      if event.type == GAME_EVENT and event.event_type == INPUT_EVENT:
         # do something with the text
         print(event.text)

These are the implemented GMEs:

  • INPUT_EVENT