particle affectors

This commit is contained in:
Henrique Santiago
2011-12-15 23:59:29 -02:00
parent 435161df62
commit ad38dad227
11 changed files with 176 additions and 100 deletions

View File

@@ -27,7 +27,7 @@
Particle::Particle(const Point& pos, const Size& size, const PointF& velocity, const PointF& acceleration, float duration, const Color& color, TexturePtr texture)
{
m_rect = Rect(pos, size);
m_pos = PointF(pos.x, pos.y);
m_position = PointF(pos.x, pos.y);
m_size = size;
m_velocity = velocity;
m_acceleration = acceleration;
@@ -66,10 +66,10 @@ void Particle::update()
// update position
PointF delta = m_velocity * elapsedTime;
delta.y *= -1; // painter orientate Y axis in the inverse direction
m_pos += delta;
m_position += delta;
// update acceleration
m_velocity += m_acceleration * elapsedTime;
m_rect.moveTo((int)m_pos.x, (int)m_pos.y);
m_rect.moveTo((int)m_position.x, (int)m_position.y);
}