pygamelib.board_items.GenericStructure

class pygamelib.board_items.GenericStructure(**kwargs)

A GenericStructure is as the name suggest, a generic object to create all kind of structures.

It can be tweaked with all the properties of BoardItem, Immovable and it can be made pickable, overlappable or restorable or any combination of these.

If you need an action to be done when a Player and/or a NPC touch the structure please have a look at pygamelib.board_items.GenericActionableStructure.

Parameters:
  • pickable (bool) – Define if the structure can be picked-up by a Player or NPC.
  • overlappable (bool) – Define if the structure can be overlapped by a Player or NPC.
  • restorable (bool) – Define if the structure can be restored by the Board after a Player or NPC passed through. For example, you want a door or an activator structure (see GenericActionableStructure for that) to remain on the board after it’s been overlapped by a player. But you could also want to develop some kind of Space Invaders game were the protection block are overlappable but not restorable.

On top of these, this object takes all parameters of BoardItem and Immovable

Important

If you need a structure with a permission system please have a look at GenericActionableStructure. This class has a permission system for activation.

__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.