BodyMemberParticle Class Reference

#include <body_member.h>

Inheritance diagram for BodyMemberParticle:

Inheritance graph
[legend]
Collaboration diagram for BodyMemberParticle:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BodyMemberParticle (Sprite *spr, const Point2i &position)

Private Member Functions

void Refresh ()

Private Attributes

double angle_rad

Detailed Description

Definition at line 26 of file body_member.h.


Constructor & Destructor Documentation

BodyMemberParticle::BodyMemberParticle ( Sprite spr,
const Point2i position 
)

Definition at line 26 of file body_member.cpp.

00026                                                                            :
00027   Particle("body_member_particle")
00028 {
00029   SetCollisionModel(false, false, false);
00030   m_left_time_to_live = 100;
00031   image = new Sprite(spr->GetSurface());
00032   image->EnableRotationCache(32);
00033   assert(image->GetWidth() != 0 && image->GetHeight()!=0);
00034   SetXY(position);
00035 
00036   SetSize(image->GetSize());
00037   SetOnTop(true);
00038   SetSpeed( (double)randomObj.GetLong(10, 15),
00039         - (double)randomObj.GetLong(0, 3000)/1000.0);
00040 }

Here is the call graph for this function:


Member Function Documentation

void BodyMemberParticle::Refresh (  )  [private, virtual]

Reimplemented from Particle.

Definition at line 42 of file body_member.cpp.

00043 {
00044   m_left_time_to_live--;
00045   UpdatePosition();
00046   Point2d speed;
00047   GetSpeedXY(speed);
00048 
00049   angle_rad += speed.Norm() * 20;
00050   angle_rad = fmod(angle_rad, 2 *M_PI);
00051   //FIXME what about negatives values ? what would happen ?
00052   if(m_left_time_to_live < 50)
00053     image->SetAlpha(m_left_time_to_live / 50.0);
00054   image->SetRotation_rad(angle_rad);
00055   image->Update();
00056 }

Here is the call graph for this function:


Member Data Documentation

double BodyMemberParticle::angle_rad [private]

Definition at line 28 of file body_member.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:36:49 2007 for Wormux by  doxygen 1.4.7