escapy.objects

Ready-made game-object classes for common escape-room mechanics.

Each class composes protocol implementations and mixin behaviour to provide a complete, reusable game object that can be placed in rooms, interacted with, and managed by the inventory system.

class escapy.objects.PickableObject(id, width, height)[source]

Bases: Interactable, InventoryInteractable, Placeable

An object that can be picked up from a room and held in-hand.

Clicking the object in the room picks it up (removes it from the room and adds it to inventory). Clicking it in the inventory puts it in-hand.

Parameters:
  • id (str) – Unique object identifier.

  • width (float) – Normalised width (fraction of the game area).

  • height (float) – Normalised height (fraction of the game area).

class escapy.objects.SelfSimpleLock(id, on_unlock, width, height)[source]

Bases: UnlockableMixin, Interactable, Unlockable, Placeable

A lock that can be opened with a simple click (no key required).

Parameters:
  • id (str) – Unique object identifier.

  • on_unlock (Command) – Command to execute when the lock is opened.

  • width (float) – Normalised width.

  • height (float) – Normalised height.

class escapy.objects.SelfKeyLock(id, key_id, on_unlock, width, height)[source]

Bases: UnlockableMixin, Interactable, Unlockable, Placeable

A lock that requires a specific key held in-hand to open.

If the player interacts without the correct key, an InteractedWithLockedEvent is emitted instead.

Parameters:
  • id (str) – Unique object identifier.

  • key_id (str) – Identifier of the key object that opens this lock.

  • on_unlock (Command) – Command to execute when the lock is opened.

  • width (float) – Normalised width.

  • height (float) – Normalised height.

class escapy.objects.SelfAskCodeLock(id, on_unlock, code, width, height)[source]

Bases: UnlockableMixin, DecodableMixin, Interactable, Unlockable, Decodable, Placeable

A lock that prompts the player to enter a numeric/text code.

When locked, interaction triggers an AskedForCodeEvent. If the submitted code matches, the lock opens and on_unlock fires.

Parameters:
  • id (str) – Unique object identifier.

  • on_unlock (Command) – Command to execute when decoded.

  • code (str) – The correct code string.

  • width (float) – Normalised width.

  • height (float) – Normalised height.

class escapy.objects.MoveToRoom(room_id, width, height)[source]

Bases: Interactable, Placeable

A clickable area that transports the player to another room.

Parameters:
  • room_id (str) – Destination room identifier.

  • width (float) – Normalised width.

  • height (float) – Normalised height.

class escapy.objects.WinMachine(id, code, win_room_id, width, height)[source]

Bases: DecodableMixin, InventoryInteractable, Decodable, Placeable

A special object that ends (wins) the game when the correct code is entered.

Interacting with it from the inventory triggers a code prompt. A correct code moves the player to the designated win room.

Parameters:
  • id (str) – Unique object identifier.

  • code (str) – The winning code string.

  • win_room_id (str) – Room to transition to upon success.

  • width (float) – Normalised width.

  • height (float) – Normalised height.

class escapy.objects.InspectableObject(id, width, height)[source]

Bases: Interactable, Placeable

An object that can be inspected (zoomed-in view) when clicked.

Parameters:
  • id (str) – Unique object identifier.

  • width (float) – Normalised width.

  • height (float) – Normalised height.

class escapy.objects.PickableInspectableObject(id, width, height)[source]

Bases: Interactable, InventoryInteractable, Placeable

An object that can be picked up from a room and inspected from the inventory.

Parameters:
  • id (str) – Unique object identifier.

  • width (float) – Normalised width.

  • height (float) – Normalised height.

class escapy.objects.MoveToRoomAndAddToInventoryObject(room_id, object_id, width, height)[source]

Bases: Interactable, Placeable

A clickable area that moves the player to another room and adds an object to the inventory.

Parameters:
  • room_id (str) – Destination room identifier.

  • object_id (str) – Object to add to the inventory on interaction.

  • width (float) – Normalised width.

  • height (float) – Normalised height.