ExplosionSprite Class Reference

An explosion caused by for example a shell exploding. More...

#include <ExplosionSprite.h>

Inheritance diagram for ExplosionSprite:

Inheritance graph
[legend]
Collaboration diagram for ExplosionSprite:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ExplosionSprite (float size=1.0, float strength=50.0, float time=1.0)
 Create a new explosion.
virtual ~ExplosionSprite ()
 Delete this sprite but do not remove it from any lists.
virtual void paint ()
 Draw this sprite on screen.
virtual void update ()
 Update this sprite's pysics and stuff.
virtual bool checkCollision (Sprite *with, bool fromSelf=false)
 Performe collision detection and handling between two sprites.
virtual bool notifyCollision (Sprite *sender)
 Notify an other sprite that we think we have collided with it.
Packet packObject () const
 Create a network packet representing vital data about this Sprite.
void setObject (Packet &p)
 Set this object's data to that represented by the packet p.

Protected Attributes

float endSize
GLfloat scale
GLfloat time
 Current "time".
GLfloat r
GLfloat g
GLfloat b
GLfloat alpha
GLuint dlist
float pow
char texRsrcKey [32]
std::set< Sprite * > m_hurt

Static Protected Attributes

static TexID texture

Detailed Description

An explosion caused by for example a shell exploding.

This sprite can inflict damage to others within its collision range.


Constructor & Destructor Documentation

ExplosionSprite::ExplosionSprite ( float  size = 1.0,
float  strength = 50.0,
float  time = 1.0 
)

Create a new explosion.

After the explosion is created its location must be set by modifying the pos parameter. The sprite automatically adds itself to the space org, the g.transparentSprites and the g.updateTransSprites lists.

Parameters:
size The size (radius) of the explosion
strength How much damage the explosion can cause.
time How long time will the explosion last.

virtual ExplosionSprite::~ExplosionSprite (  )  [virtual]

Delete this sprite but do not remove it from any lists.


Member Function Documentation

virtual bool ExplosionSprite::checkCollision ( Sprite with,
bool  fromSelf = false 
) [virtual]

Performe collision detection and handling between two sprites.

Parameters:
with The sprite to performe collision detection with.
fromSelf set this to true when the collision check originates from one self, normally all external callers should leave this variable at the default (false) value.
Returns:
true if a collision was detected, false otherwise.

Reimplemented from Sprite.

virtual bool ExplosionSprite::notifyCollision ( Sprite sender  )  [virtual]

Notify an other sprite that we think we have collided with it.

Parameters:
sender Pointer to the sprite that detected the collision.
Returns:
true if the receiving object accepts this as a collision, false otherwise.

Reimplemented from Sprite.

Packet ExplosionSprite::packObject (  )  const [virtual]

Create a network packet representing vital data about this Sprite.

The default implementation packs an SPRITE_UDATE string followed by the sprites URI and all physics data in the form pos[0] rot[0] vel[0] ... aVel[3].

See also:
setObject

Reimplemented from Sprite.

virtual void ExplosionSprite::paint (  )  [virtual]

Draw this sprite on screen.

The paint method is allowed to change the model-view matrix and any pushable attributes.

Implements Sprite.

void ExplosionSprite::setObject ( Packet p  )  [virtual]

Set this object's data to that represented by the packet p.

The default implementation unpacks a packet created by the default impl. of packObject().

Reimplemented from Sprite.

virtual void ExplosionSprite::update (  )  [virtual]

Update this sprite's pysics and stuff.

Note that the update method should use the static dTime variable to check the time since last invokation. The caller is responsible for setting this variable to an apropriate value!

Implements Sprite.


Member Data Documentation

GLfloat ExplosionSprite::alpha [protected]

GLfloat ExplosionSprite::b [protected]

GLuint ExplosionSprite::dlist [protected]

float ExplosionSprite::endSize [protected]

GLfloat ExplosionSprite::g [protected]

std::set<Sprite*> ExplosionSprite::m_hurt [protected]

float ExplosionSprite::pow [protected]

GLfloat ExplosionSprite::r [protected]

GLfloat ExplosionSprite::scale [protected]

char ExplosionSprite::texRsrcKey[32] [protected]

TexID ExplosionSprite::texture [static, protected]

GLfloat ExplosionSprite::time [protected]

Current "time".

Reimplemented from Sprite.


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 15:33:26 2007 for MetalWarriors by  doxygen 1.4.7