scripts :: objects :: actors :: CharacterBase :: Class CharacterBase
[hide private]
[frames] | no frames]

Class CharacterBase

source code

     object --+            
              |            
base.BaseObject --+        
                  |        
 base.DynamicObject --+    
                      |    
        base.GameObject --+
                          |
         object --+       |
                  |       |
    base.BaseObject --+   |
                      |   |
            base.Living --+
                          |
         object --+       |
                  |       |
    base.BaseObject --+   |
                      |   |
         base.CharStats --+
                          |
                         CharacterBase

Base class for Characters

Instance Methods [hide private]
 
__init__(self, ID, agent_layer=None, inventory=None, text="", **kwargs)
Set the basic values that are shared by all game objects.
source code
 
createBehaviour(self, layer)
Creates the behaviour for this actor.
source code
 
setup(self)
Returns: None
source code
 
start(self)
Returns: None
source code
 
teleport(self, location)
Teleports a Character instantly to the given location.
source code
 
give(self, item, actor)
Gives the specified item to the different actor.
source code
 
hasItem(self, item_type)
Returns wether an item is present in the players inventory or not
source code
 
itemCount(self, item_type="")
Returns number of all items or items specified by item_type the player has.
source code
fife.Location
getLocation(self)
Get the NPC's position as a fife.Location object.
source code
 
run(self, location)
Makes the PC run to a certain location
source code
 
walk(self, location)
Makes the PC walk to a certain location.
source code
 
getStateForSaving(self)
Returns state for saving
source code
 
_getCoords(self)
Get-er property function
source code
 
_setCoords(self, coords)
Set-er property function
source code

Inherited from base.GameObject: __repr__

Inherited from base.DynamicObject: __getstate__, __setstate__, prepareStateForSaving, restoreState

Inherited from base.Living: die

Inherited from base.BaseObject: trueAttr

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  coords = property(_getCoords, _setCoords, doc= "Property allow...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, ID, agent_layer=None, inventory=None, text="", **kwargs)
(Constructor)

source code 

Set the basic values that are shared by all game objects.

Parameters:
  • ID - Unique object identifier. Must be present.
  • gfx - Dictionary with graphics for the different contexts @type coords 2-item tuple
  • coords - Initial coordinates of the object.
  • map_id - Identifier of the map where the object is located
  • blocking - Whether the object blocks character movement
  • name - The display name of this object (e.g. 'Dirty crate')
  • text - A longer description of the item
  • desc - A long description of the item that is displayed when it is examined
Overrides: object.__init__
(inherited documentation)

createBehaviour(self, layer)

source code 

Creates the behaviour for this actor.

Returns:
None

setup(self)

source code 
Returns:
None

start(self)

source code 
Returns:
None

teleport(self, location)

source code 

Teleports a Character instantly to the given location.

Parameters:
  • location (fife.Location) - Target coordinates for Character.
Returns:
None

give(self, item, actor)

source code 

Gives the specified item to the different actor. Raises an exception if the item was invalid or not found

Parameters:
  • item (Carryable) - The item object to give
  • actor - Person to give item to

hasItem(self, item_type)

source code 

Returns wether an item is present in the players inventory or not

Parameters:
  • item_type (str) - ID of the item
Returns:
True when the item is present, False when not

itemCount(self, item_type="")

source code 

Returns number of all items or items specified by item_type the player has.

Parameters:
  • item_type (str) - ID of the item, can be empty
Returns:
Number of items

getLocation(self)

source code 

Get the NPC's position as a fife.Location object. Basically a wrapper.

Returns: fife.Location
the location of the NPC

run(self, location)

source code 

Makes the PC run to a certain location

Parameters:
  • location (fife.ScreenPoint) - Screen position to run to.
Returns:
None

walk(self, location)

source code 

Makes the PC walk to a certain location.

Parameters:
  • location (fife.ScreenPoint) - Screen position to walk to.
Returns:
None

getStateForSaving(self)

source code 

Returns state for saving

Overrides: base.BaseObject.getStateForSaving

_getCoords(self)

source code 

Get-er property function

Overrides: base.GameObject._getCoords

_setCoords(self, coords)

source code 

Set-er property function

Overrides: base.GameObject._setCoords

Class Variable Details [hide private]

coords

Value:
property(_getCoords, _setCoords, doc= "Property allowing you to get an\
d set the object's \
                coordinates via tuples")