109 int pixelX,
int pixelY,
int rotation = 0);
115 const gcn::Color *color, gcn::Font *font,
116 bool outline =
false);
122 int x,
int y,
const gcn::Color *color, gcn::Font *font,
123 bool outline =
false);
140 void moveTo(
float x,
float y);
313 other.mParticle =
nullptr;
331 other.mParticle =
nullptr;
Vector mPos
Position in pixels relative to map.
A central point of control for graphics.
Every Particle can have one or more particle emitters that create new particles when they are updated...
Particle * operator->() const
ParticleHandle(const ParticleHandle &)=delete
ParticleHandle(ParticleHandle &&other)
ParticleHandle & operator=(ParticleHandle &&other)
ParticleHandle & operator=(const ParticleHandle &)=delete
ParticleHandle(Particle *particle=nullptr)
A particle spawned by a ParticleEmitter.
Particles mChildParticles
List of particles controlled by this particle.
void kill()
Manually marks the particle for deletion.
float mBounce
How much the particle bounces off when hitting the ground.
float getCurrentAlpha() const
Calculates the current alpha transparency taking current fade status into account.
void setAllowSizeAdjust(bool adjust)
void setVelocity(float x, float y, float z)
Sets the current velocity in 3 dimensional space.
float mMomentum
How much speed the particle retains after each game tick.
void setRandomness(int r)
Sets the ammount of random vector changes.
float mGravity
Downward acceleration in pixels per game-tick.
void setAlpha(float alpha) override
Sets the alpha value used to draw the actor.
bool doesFollow() const
Gets the flag if the particle is supposed to be moved by its parent.
virtual void setDeathEffect(const std::string &effectFile, char conditions)
AliveStatus mAlive
Is the particle supposed to be drawn and updated?
int mRandomness
Ammount of random vector change.
static void setupEngine()
Gives a particle the properties of an engine root particle and loads the particle-related config sett...
static const float PARTICLE_SKY
Maximum Z position of particles.
static int particleCount
Current number of particles.
static int maxCount
Maximum number of particles.
void moveBy(const Vector &change)
Changes the particle position relative.
void addEmitter(ParticleEmitter *emitter)
Adds an emitter to the particle.
int mFadeIn
Age in game ticks where fading in is finished.
bool isExtinct() const
Determines whether the particle and its children are all dead.
void setFadeIn(int fadeIn)
Sets the remaining particle lifetime where the particle starts to fade out.
void disableAutoDelete()
After calling this function the particle will only request deletion when kill() is called.
float mAcceleration
Acceleration towards the target particle in pixels per game-tick.
bool draw(Graphics *graphics, int offsetX, int offsetY) const override
Draws the particle image.
Particle * mTarget
The particle that attracts this particle.
bool mAutoDelete
May the particle request its deletion by the parent particle?
Particle * createChild()
Creates a blank particle as a child of the current particle Useful for creating target particles.
Particle * addTextRiseFadeOutEffect(const std::string &text, int x, int y, const gcn::Color *color, gcn::Font *font, bool outline=false)
Creates a standalone text particle.
std::string mDeathEffect
Particle effect file to be spawned when the particle dies.
float mInvDieDistance
Distance in pixels from the target particle that causes the destruction of the particle.
int mLifetimePast
Age of the particle in game ticks.
float mAlpha
Opacity of the graphical representation of the particle.
void setGravity(float gravity)
Sets the downward acceleration.
int mLifetimeLeft
Lifetime left in game ticks.
static int fastPhysics
Mode of squareroot calculation.
virtual bool update()
Updates particle position, returns false when the particle should be deleted.
void moveTo(const Vector &pos)
Sets the position in 3 dimensional space in pixels relative to map.
static int emitterSkip
Duration of pause between two emitter updates in ticks.
bool drawnWhenBehind() const override
Do not draw particles when behind other objects.
void setDieDistance(float dist)
Sets the distance in pixel the particle can come near the target particle before it is destroyed.
void setLifetime(int lifetime)
Sets the time in game ticks until the particle is destroyed.
void clear()
Deletes all child particles and emitters.
bool mAllowSizeAdjust
Can the effect size be adjusted by the object props in the map file?
void setDestination(Particle *target, float accel, float moment)
Makes the particle move toward another particle with a given acceleration and momentum.
bool mFollow
is this particle moved when its parent particle moves?
char mDeathEffectConditions
Bitfield of death conditions which trigger spawning of the death particle.
int mFadeOut
Lifetime in game ticks left where fading out begins.
Vector mVelocity
Speed in pixels per game-tick.
float getAlpha() const override
Returns the current alpha value used to draw the actor.
void setBounce(float bouncieness)
Sets the ammount of velocity particles retain after hitting the ground.
Particle * addTextSplashEffect(const std::string &text, int x, int y, const gcn::Color *color, gcn::Font *font, bool outline=false)
Creates a standalone text particle.
Emitters mChildEmitters
List of child emitters.
void setFadeOut(int fadeOut)
Sets the age of the pixel in game ticks where the particle has faded in completely.
Particle * addEffect(const std::string &particleEffectFile, int pixelX, int pixelY, int rotation=0)
Creates a child particle that hosts some emitters described in the particleEffectFile.
void adjustEmitterSize(int w, int h)
Changes the size of the emitters so that the effect fills a rectangle of this size.
static bool enabled
true when non-crucial particle effects are disabled
void setFollow(bool follow)
Sets the flag if the particle is supposed to be moved by its parent.
Particle * particleEngine
std::list< Particle * > Particles
std::list< ParticleEmitter * > Emitters