Next: Index, Previous: Module color, Up: Top [Contents][Index]
This chapter describes the field module in detail, but most of the time you don’t have to know much more than that you can access theyr contents like lists.
The Field class is one field at the Map. It holds all objects that
are on one position on a Map. It inherits from list
and you
can access t just like a list. A field has a __str__ and a color
method that returns the values of the Obj on top of the Field.
Here are all methods defined in Field. Note that Field inherits from
list
and has alle the methods from list
.
This method takes two needed and one optional argument. The two needed are the coordinates this Field represents. The optional is a str that is returned by __str__ if there is no Obj on the Field.
This method returns the Obj on top of the Field or None, if the Field is empty.
This returns the str of the Obj on top of the Field. So the field looks like the Obj on top of it. If there is no Obj on the Field it returns self.defstr. See Field.defstr.
THis method returns the color of the Obj on top of the Field. So the
field looks like the Obj on top of it. If there is no Obj on the
Field it returns cursgame.color.WHITE
. See colors.
This returns the representation in the form Field([contents of
field...])
.
Here are all the important attributes of Field
These are the coordinates where the Field is.
This is the string that is used for the Field if it’s empty. You can change it at runtime.
Next: Index, Previous: Module color, Up: Top [Contents][Index]