Next: Module color, Previous: Module inp, Up: Top [Contents][Index]
This chapter describes the contents of the character module in detail.
This class is a metaclass for all stuff that can be placed on in the game. See the documentation for the abc module for more on metaclasses.
Here are all methods of the Obj class.
Does nothing in your interest. Takes no arguments.
Changes the position of the Obj by the two given arguments, relative to the current position.
The return value is used for representing the Obj in the game. This is an abstract method, so you need to override it in a subclass.
This function should return a valid curses color-code. These color
codes are defined in the cursgame.color
module. See colors.
This method is called if some other Obj wants to step on the field this Obj is on. You can use it to whatever. It defaults to killing the object and removing it from the game (including the action-loop if it’s on it). The return value is used to determine wether the mofing Obj should be moved or not. If you return True, the moving Obj is moved. If you return False the moving Obj stays where it was. By default True is returned, so if you step on an Obj not overriding activate you step on it and killing it. You can override it and do anything you want. You can even do nothing (for example walls do nothing except returning False). If on a Field is more than one Obj the activate method is only called on the Obj on the top.
This method is called once per frame, if the Obj is placed on the action-loop. This is usually the case if you placed it with the last argument to Map.place as True.
Here are all important attributes of the Obj.
This attribute contains an tuple with the coordinates of the Obj (x first item).
This variable contains the map this Obj is on.
This variable is True when the Obj is dead. Note that this attribute doesn’t have any effect on Cursgame. It is only for the user.
This class is a default human. You obviously don’t have to use this Human and can make you own that fits your needs better. It inherits from Obj. See Obj.
Here are the methods of Human
returns "@"
. See Obj.__str__.
returns cursgame.color.BLUE
, which means the Human is displayed
blue. See Obj.color.
Next: Module color, Previous: Module inp, Up: Top [Contents][Index]