pygamelib.board_items.Actionable¶
-
class
pygamelib.board_items.
Actionable
(**kwargs)¶ This class derives
Immovable
. It adds the ability to an Immovable BoardItem to be triggered and execute some code.Parameters: - action (function) – the reference to a function (Attention: no parentheses at the end of the function name).
- action_parameters (list) – the parameters to the action function.
- perm (
constants
) – The permission that defines what types of items can actually activate the actionable. The permission has to be one of the permissions defined inconstants
On top of these parameters Actionable accepts all parameters from
Immovable
and therefor fromBoardItem
.Note
The common way to use this class is to use GenericActionableStructure. Please refer to
GenericActionableStructure
for more details.-
__init__
(**kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(**kwargs)Initialize self. activate
()This function is calling the action function with the action_parameters. 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 is a virtual method that must be implemented in deriving class. pickable
()This is a virtual method that must be implemented in deriving class. position_as_vector
()Returns the current item position as a Vector2D restorable
()This is a virtual method that must be implemented in deriving class. row
Convenience method to get the current stored row of the item. store_position
(row, column)Store the BoardItem position for self access. width
Convenience method to get the width of the item.