Player Enabled

class quest.contrib.player_enabled.PlayerEnabledMixin[source]

Extends quest.QuestGame to allow setting whether the player is enabled or not. When the player is disabled, user input is ignored. Note that the game may still take actions affecting the player sprite, just not the user.

Attrs:

player_enabled (bool): When True (default), user input controls the player.

on_key_press(key, modifiers)[source]

Delegates to the regular on_key_press method when player_enabled is True.

Parameters
  • key – The key that was pressed.

  • modifiers – A list of currently-active modifier keys (e.g. shift).

on_mouse_motion(x, y, dx, dy)[source]

Delegates to the regular on_mouse_motion when player_enabled is True.

Parameters
  • x (float) – x position of mouse

  • y (float) – y position of mouse

  • dx (float) – Change in x since the last time this method was called

  • dy (float) – Change in y since the last time this method was called