#include <teleport_member.h>
Inheritance diagram for TeleportMemberParticle:


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 |
Definition at line 28 of file teleport_member.h.
| 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:

| 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:

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.
1.4.7