pygamelib.board_items.Door

class pygamelib.board_items.Door(**kwargs)

A Door is a GenericStructure that is not pickable, overlappable and restorable. It has a value of 0 and a size of 1 by default. It is an helper class that allows to focus on game design and mechanics instead of small building blocks.

Parameters:
  • model (str) – The model that will represent the door on the map
  • value (int) – The value of the door, it is useless in that case. The default value is 0.
  • inventory_space (int) – The size of the door in the inventory. Unless you make the door pickable (I have no idea why you would do that…), this parameter is not used.
  • type (str) – The type of the door. It is often used as a type identifier for your game main loop. For example: unlocked_door or locked_door.
  • pickable (Boolean) – Is this door pickable by the player? Default value is False.
  • overlappable (Boolean) – Is this door overlappable by the player? Default value is True.
  • restorable (Boolean) – Is this door restorable after being overlapped? Default value is True.

Note

All the options from GenericStructure are also available to this constructor.

Example:

door1 = Door(model=Sprites.DOOR,type='locked_door')
__init__(**kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(**kwargs) Initialize self.
can_move() Return the capability of moving of an item.
collides_with(other) Tells if this item collides with another item.
column Convenience method to get the current stored column of the item.
debug_info() Return a string with the list of the attributes and their current value.
display() Print the model WITHOUT carriage return.
distance_to(other) Calculates the distance with an item.
height Convenience method to get the height of the item.
inventory_space() Return the size of the Immovable Item for the Inventory.
overlappable() This represent the capacity for a BoardItem to be overlapped by player or NPC.
pickable() This represent the capacity for a BoardItem to be picked-up by player or NPC.
position_as_vector() Returns the current item position as a Vector2D
restorable() This represent the capacity for an Immovable BoardItem (in this case a GenericStructure item) to be restored by the board if the item is overlappable and has been overlapped by another Movable item.
row Convenience method to get the current stored row of the item.
set_overlappable(val) Make the structure overlappable or not.
set_pickable(val) Make the structure pickable or not.
set_restorable(val) Make the structure restorable or not.
store_position(row, column) Store the BoardItem position for self access.
width Convenience method to get the width of the item.