Subverse Project - Manual
Functions
Element(World*, string, int)
Elements Constructor. Needs as parameters the world pointer, a string to namming the element and a int that set a type of element.
bool isAlive()
Returns true if element is alive and false case element is dead.
bool isCreature()
This function verify if element is a creature, i.e. na animal.
bool isUnderAttack()
Verify if element is under attack by an other element/animal.
bool attack(Element* e)
Attack an other element "e". It needs to be different of NULL.
bool move(int direction)
This function move the element to a direction (DOWN, RIGHT, UP, LEFT, DOWN_RIGHT, DOWN_LEFT, UP_RIGHT, UP_LEFT).
bool eat(Element* e)
Eats determined element e and returns true if success.
bool areAttackedBy(Element* )
Returns if element are attacked by element e.
void setCreature(bool)
Set if element is a ceature (animal), not a plant or fire or etc...
setVisionRange(int)
Set range of element vision. Default is 3.
int getHealth()
Return Health of user, in percent. When health turns 0, the element dies.
int getFood()
return how much food element have, fruits in plants or meats in dead elements.
int getDirection()
Returns direction where element is going.
int getX()
Returns x position of element in world.
int getY()
Returns y position of element in world.
int getType()
Returns type of object, configured in constructor.
Element* getAround(int position, int type)
Returns a element in some position around element (FRONT, LEFT, RIGHT, BACK) with type (ELEMENT or LAND).
Element* getAttacker()
Returns element that is attacking, if there is. If not, returns NULL.
Vision* getVision()
Returns vision of element.
string getName()
Returns name of element.
void setDirection(int)
Set a new direction to element.
void execute()
Execute behaviour of element.

[voltar]