Annchienta::StaticObject Class Reference

Inherits Annchienta::Entity.

Inherited by Annchienta::Person, and SwigDirector_StaticObject.

List of all members.

Public Member Functions

void calculateCollidingTiles ()
virtual bool canInteract () const
bool collidesWithOtherObjects () const
virtual void draw ()
virtual void freeze (bool)
const char * getAnimation () const
virtual int getDepth ()
virtual EntityType getEntityType () const
virtual MaskgetMask () const
virtual Point getMaskPosition () const
virtual Point getPosition () const
SurfacegetSprite () const
const char * getXmlFile () const
float getZFromCollidingTiles ()
virtual bool isPassable () const
virtual void lookAt (StaticObject *other)
virtual void onInteract ()
bool setAnimation (const char *animationName)
virtual void setOnInteractCode (const char *code)
virtual void setOnInteractScript (const char *script)
virtual void setPassable (bool passable)
virtual void setPosition (Point position)
virtual void setSprite (const char *filename)
virtual void setStandAnimation (bool b=false)
 StaticObject (const char *name, Surface *surf, Mask *mask)
 StaticObject (const char *name, const char *configfile)
virtual bool stepTo (Point)
virtual void update ()
virtual ~StaticObject ()

Protected Attributes

std::vector< Animation * > animations
std::list< Tile * > collidingTiles
int currentAnimation
int currentFrame
std::vector< Frame * > frames
Point mapPosition
Maskmask
char * onInteractCode
char * onInteractScript
bool passable
Point position
int speedTimer
Surfacesprite
TiletileStandingOn
char xmlFile [DEFAULT_STRING_SIZE]


Detailed Description

A StaticObject is an Entity in the Map that has a sprite, animations, a position... but it cannot move. Use a Person for that.

Constructor & Destructor Documentation

Annchienta::StaticObject::StaticObject ( const char *  name,
const char *  configfile 
)

Create a new StaticObject.

Parameters:
name Name for this StaticObject.
configfile XML File where animations, sprite etc. should be loaded from.

Annchienta::StaticObject::StaticObject ( const char *  name,
Surface surf,
Mask mask 
)

Create a new StaticObject without a config file. This is used to create simple objects which do not have animations.

Parameters:
name Name for this StaticObject.
surf Sprite for this StaticObject.
mask Collision mask for this StaticObject.

virtual Annchienta::StaticObject::~StaticObject (  )  [virtual]


Member Function Documentation

void Annchienta::StaticObject::calculateCollidingTiles (  ) 

This function calculates which tiles the StaticObject is colliding with and stores them internally.

Warning:
This function should only be used internally.

virtual bool Annchienta::StaticObject::canInteract (  )  const [virtual]

Returns:
If this object has an interact script or interact code.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

bool Annchienta::StaticObject::collidesWithOtherObjects (  )  const

This function check if this StaticObject collides with other Objects in the same layer.

Returns:
If there is a collision between this and any other StaticObject.

virtual void Annchienta::StaticObject::draw (  )  [virtual]

Draws this StaticObject to the screen.

Implements Annchienta::Entity.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual void Annchienta::StaticObject::freeze ( bool   )  [virtual]

const char* Annchienta::StaticObject::getAnimation (  )  const

Get the name of the currently playing animation.

Returns:
The name of the currently playing animation.

virtual int Annchienta::StaticObject::getDepth (  )  [virtual]

Returns:
The depth this StaticObject should be sorted on.

Implements Annchienta::Entity.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual EntityType Annchienta::StaticObject::getEntityType (  )  const [virtual]

Returns:
The EntityType of this StaticObject.

Implements Annchienta::Entity.

Reimplemented in SwigDirector_StaticObject, SwigDirector_Person, and Annchienta::Person.

virtual Mask* Annchienta::StaticObject::getMask (  )  const [virtual]

Returns:
The Mask for this StaticObject.

Implements Annchienta::Entity.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual Point Annchienta::StaticObject::getMaskPosition (  )  const [virtual]

Returns:
The position where the Mask of this StaticObject should be placed to calculate collisions.

Implements Annchienta::Entity.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual Point Annchienta::StaticObject::getPosition (  )  const [virtual]

Returns:
The position of this StaticObject.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

Surface* Annchienta::StaticObject::getSprite (  )  const

Returns:
The current sprite used.

const char* Annchienta::StaticObject::getXmlFile (  )  const

Returns:
The XML file this StaticObject was loaded from, otherwise 0.

float Annchienta::StaticObject::getZFromCollidingTiles (  ) 

This function calculates the current Z coordinate of this StaticObject and returns it.

Warning:
This function should only be used internally.
Returns:
The new Z coordinate.

virtual bool Annchienta::StaticObject::isPassable (  )  const [virtual]

If this object is passable, other objects can "walk through" it.

Returns:
If this object is passable.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual void Annchienta::StaticObject::lookAt ( StaticObject other  )  [virtual]

virtual void Annchienta::StaticObject::onInteract (  )  [virtual]

When you call this function, this object's interact script and/or code will be executed if they exist.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

bool Annchienta::StaticObject::setAnimation ( const char *  animationName  ) 

Set the animation for this StaticObject. Animations should be declared in it's XML file.

Parameters:
animationName Name of the to be set animation.
Returns:
If the animation set was succesful.

virtual void Annchienta::StaticObject::setOnInteractCode ( const char *  code  )  [virtual]

Sets this object's interact code. This code will be executed when the object is interacted with.

Parameters:
code Code to be executed.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual void Annchienta::StaticObject::setOnInteractScript ( const char *  script  )  [virtual]

Sets this object's interact script. This script will be executed when the object is interacted with.

Parameters:
script Filename of the script.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual void Annchienta::StaticObject::setPassable ( bool  passable  )  [virtual]

If this object is passable, other objects can "walk through" it.

Parameters:
passable If this object should be passable.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual void Annchienta::StaticObject::setPosition ( Point  position  )  [virtual]

Sets the position for this StaticObject.

Parameters:
position The new position.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual void Annchienta::StaticObject::setSprite ( const char *  filename  )  [virtual]

Should be used with care, because the frame settings stay the same.

Warning:
Make sure the new sprite has the same dimensions and frames.
Parameters:
filename Filename of the new sprite.

Reimplemented in SwigDirector_StaticObject, and SwigDirector_Person.

virtual void Annchienta::StaticObject::setStandAnimation ( bool  b = false  )  [virtual]

virtual bool Annchienta::StaticObject::stepTo ( Point   )  [virtual]

Reimplemented in SwigDirector_StaticObject.

virtual void Annchienta::StaticObject::update (  )  [virtual]

Updates this Entity. This is called when updating the Map this Entity is in.

Implements Annchienta::Entity.

Reimplemented in SwigDirector_StaticObject, SwigDirector_Person, and Annchienta::Person.


Member Data Documentation

std::vector<Animation*> Annchienta::StaticObject::animations [protected]

std::vector<Frame*> Annchienta::StaticObject::frames [protected]

char Annchienta::StaticObject::xmlFile[DEFAULT_STRING_SIZE] [protected]


Generated on Wed Feb 4 16:31:47 2009 for Annchienta by  doxygen 1.5.7.1