TeleportMemberParticle Class Reference

#include <teleport_member.h>

Inheritance diagram for TeleportMemberParticle:

Inheritance graph
[legend]
Collaboration diagram for TeleportMemberParticle:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TeleportMemberParticle (Sprite *spr, const Point2i &position, const Point2i &dest, int direction)
 ~TeleportMemberParticle ()
void Refresh ()

Private Attributes

uint time
Point2i destination
Point2i start
float sin_x_max
float sin_y_max

Detailed Description

Definition at line 28 of file teleport_member.h.


Constructor & Destructor Documentation

TeleportMemberParticle::TeleportMemberParticle ( Sprite spr,
const Point2i position,
const Point2i dest,
int  direction 
)

Definition at line 28 of file teleport_member.cpp.

00028                                                                                                                        :
00029   Particle("teleport_member_particle")
00030 {
00031   SetCollisionModel(true, false, false);
00032   image = new Sprite(spr->GetSurface());
00033 
00034   float scale_x, scale_y;
00035   image->GetScaleFactors(scale_x, scale_y);
00036   image->Scale(scale_x * (float)direction, scale_y);
00037 
00038   assert(image->GetWidth() != 0 && image->GetHeight()!=0);
00039   SetXY(position);
00040   m_left_time_to_live = 1;
00041 
00042   SetSize(image->GetSize());
00043   SetOnTop(true);
00044   destination = dest;
00045   start = position;
00046   time = Time::GetInstance()->Read();
00047 
00048   sin_x_max = randomObj.GetDouble(M_PI_4, 3.0 * M_PI_4);
00049   sin_y_max = randomObj.GetDouble(M_PI_4, 3.0 * M_PI_4);
00050   camera.FollowObject(this, true, true);
00051 }

Here is the call graph for this function:

TeleportMemberParticle::~TeleportMemberParticle (  ) 

Definition at line 53 of file teleport_member.cpp.

00054 {
00055   camera.StopFollowingObj(this);
00056 }

Here is the call graph for this function:


Member Function Documentation

void TeleportMemberParticle::Refresh (  )  [virtual]

Reimplemented from Particle.

Definition at line 58 of file teleport_member.cpp.

00059 {
00060   uint now = Time::GetInstance()->Read();
00061   if(now > time + teleportation_anim_duration)
00062     m_left_time_to_live = 0;
00063 
00064   uint dt = now - time;
00065   Point2i dpos;
00066   dpos.x = (int)((destination.x - start.x) * sin((float)dt * sin_x_max / (float)teleportation_anim_duration) / sin(sin_x_max))/* * dt / teleportation_anim_duration*/;
00067   dpos.y = (int)((destination.y - start.y) * sin((float)dt * sin_y_max / (float)teleportation_anim_duration) / sin(sin_y_max))/* * dt / teleportation_anim_duration*/;
00068 
00069   SetXY( start + dpos );
00070   image->Update();
00071 }

Here is the call graph for this function:


Member Data Documentation

Point2i TeleportMemberParticle::destination [private]

Definition at line 31 of file teleport_member.h.

float TeleportMemberParticle::sin_x_max [private]

Definition at line 33 of file teleport_member.h.

float TeleportMemberParticle::sin_y_max [private]

Definition at line 34 of file teleport_member.h.

Point2i TeleportMemberParticle::start [private]

Definition at line 32 of file teleport_member.h.

uint TeleportMemberParticle::time [private]

Definition at line 30 of file teleport_member.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:24:55 2007 for Wormux by  doxygen 1.4.7