particles on center

This commit is contained in:
Henrique Santiago 2011-12-16 13:32:49 -02:00
parent bf28a92e31
commit bb0860c5d0
3 changed files with 34 additions and 15 deletions

View File

@ -2,24 +2,42 @@ ParticleSystem
AttractionAffector AttractionAffector
destination: 200 200 destination: 200 200
acceleration: 128 acceleration: 64
velocity-reduction-percent: 10 velocity-reduction-percent: 0
Emitter Emitter
position: 200 200 position: 200 264
burstRate: 1 duration: 12
burstCount: 128 burstRate: 2
burstCount: 1
delay: 0.5
particle-duration: 2 particle-duration: 9999
particle-position-radius: 0 particle-position-radius: 0
particle-velocity: 128 particle-velocity: 64
particle-min-velocity-angle: 0 particle-velocity-angle: 0
particle-max-velocity-angle: 360
particle-acceleration: 0 particle-acceleration: 0
particle-size: 32 32 particle-size: 32 32
particle-color: #33ff3344 particle-color: #33ff33ff
particle-texture: circle2.png
Emitter
position: 200 200
burstRate: 9999999999
burstCount: 1
particle-duration: 9999999
particle-position-radius: 0
particle-velocity: 0
particle-velocity-angle: 0
particle-acceleration: 0
particle-size: 32 32
particle-color: #33ff33ff
particle-texture: circle2.png particle-texture: circle2.png

View File

@ -71,5 +71,5 @@ void Particle::update()
// update acceleration // update acceleration
m_velocity += m_acceleration * elapsedTime; m_velocity += m_acceleration * elapsedTime;
m_rect.moveTo((int)m_position.x, (int)m_position.y); m_rect.moveTo((int)m_position.x - m_size.width() / 2, (int)m_position.y - m_size.height() / 2);
} }

View File

@ -42,23 +42,24 @@ public:
TSize<T> toSize() const { return TSize<T>(x, y); } TSize<T> toSize() const { return TSize<T>(x, y); }
TPoint<T> operator-() const { return TPoint<T>(-x, -y); } TPoint<T> operator-() const { return TPoint<T>(-x, -y); }
TPoint<T> operator+(const TPoint<T>& other) const { return TPoint<T>(x + other.x, y + other.y); } TPoint<T> operator+(const TPoint<T>& other) const { return TPoint<T>(x + other.x, y + other.y); }
TPoint<T>& operator+=(const TPoint<T>& other) { x+=other.x; y+=other.y; return *this; } TPoint<T>& operator+=(const TPoint<T>& other) { x+=other.x; y+=other.y; return *this; }
TPoint<T> operator-(const TPoint<T>& other) const { return TPoint<T>(x - other.x, y - other.y); } TPoint<T> operator-(const TPoint<T>& other) const { return TPoint<T>(x - other.x, y - other.y); }
TPoint<T>& operator-=(const TPoint<T>& other) { x-=other.x; y-=other.y; return *this; } TPoint<T>& operator-=(const TPoint<T>& other) { x-=other.x; y-=other.y; return *this; }
TPoint<T> operator*(const TPoint<T>& other) const { return TPoint<T>(x * other.x, y * other.y); } TPoint<T> operator*(const TPoint<T>& other) const { return TPoint<T>(x * other.x, y * other.y); }
TPoint<T>& operator*=(const TPoint<T>& other) { x*=other.x; y*=other.y; return *this; } TPoint<T>& operator*=(const TPoint<T>& other) { x*=other.x; y*=other.y; return *this; }
TPoint<T> operator*(const T v) const { return TPoint<T>(x*v, y*v); }
TPoint<T>& operator*=(const T v) { x*=v; y*=v; return *this; }
TPoint<T> operator/(const TPoint<T>& other) const { return TPoint<T>(x/other.x, y/other.y); } TPoint<T> operator/(const TPoint<T>& other) const { return TPoint<T>(x/other.x, y/other.y); }
TPoint<T>& operator/=(const TPoint<T>& other) { x/=other.x; y/=other.y; return *this; } TPoint<T>& operator/=(const TPoint<T>& other) { x/=other.x; y/=other.y; return *this; }
TPoint<T> operator/(const T v) const { return TPoint<T>(x/v, y/v); }
TPoint<T>& operator/=(const T v) { x/=v; y/=v; return *this; }
TPoint<T> operator+(T other) const { return TPoint<T>(x + other, y + other); } TPoint<T> operator+(T other) const { return TPoint<T>(x + other, y + other); }
TPoint<T>& operator+=(T other) { x+=other; y+=other; return *this; } TPoint<T>& operator+=(T other) { x+=other; y+=other; return *this; }
TPoint<T> operator-(T other) const { return TPoint<T>(x - other, y - other); } TPoint<T> operator-(T other) const { return TPoint<T>(x - other, y - other); }
TPoint<T>& operator-=(T other) { x-=other; y-=other; return *this; } TPoint<T>& operator-=(T other) { x-=other; y-=other; return *this; }
TPoint<T> operator*(const T v) const { return TPoint<T>(x*v, y*v); }
TPoint<T>& operator*=(const T v) { x*=v; y*=v; return *this; }
TPoint<T> operator/(const T v) const { return TPoint<T>(x/v, y/v); }
TPoint<T>& operator/=(const T v) { x/=v; y/=v; return *this; }
bool operator<=(const TPoint<T>&other) const { return x<=other.x && y<=other.y; } bool operator<=(const TPoint<T>&other) const { return x<=other.x && y<=other.y; }
bool operator>=(const TPoint<T>&other) const { return x>=other.x && y>=other.y; } bool operator>=(const TPoint<T>&other) const { return x>=other.x && y>=other.y; }