diff --git a/source/effects/Bullet.cpp b/source/effects/Bullet.cpp index 224a5b0..6cdb4f8 100755 --- a/source/effects/Bullet.cpp +++ b/source/effects/Bullet.cpp @@ -20,10 +20,11 @@ const float Bullet::SPEED = 500.0f; * @param texture Texture to display for bullet. */ Bullet::Bullet(const Vector2f& position, b2World& world, - const std::shared_ptr& texture, Physical& shooter, float direction) : + const std::shared_ptr& texture, Physical& shooter, float direction, int damage) : Particle(texture, PhysicalData(position, Vector2i(20, 20), world, CATEGORY_PARTICLE, CATEGORY_PARTICLE, true, true)), - mShooter(shooter) { + mShooter(shooter), + mDamage(damage) { setSpeed(angle(direction), SPEED); setAngle(direction); } @@ -38,7 +39,7 @@ Bullet::onCollide(Physical& other, uint16 type) { // Call onShot on other, with damage as param. if (type == CATEGORY_ACTOR) { Actor& a = dynamic_cast(other); - a.onDamage(10); + a.onDamage(mDamage); } setDelete(true); } diff --git a/source/effects/Bullet.h b/source/effects/Bullet.h index 2aa7799..debbef8 100755 --- a/source/effects/Bullet.h +++ b/source/effects/Bullet.h @@ -17,7 +17,7 @@ class Bullet : public Particle { // Public functions. public: Bullet(const Vector2f& position, b2World& world, const std::shared_ptr& texture, - Physical& shooter, float direction); + Physical& shooter, float direction, int damage); void onCollide(Physical& other, uint16 category); bool doesCollide(Physical& other); @@ -26,6 +26,7 @@ public: private: static const float SPEED; Physical& mShooter; + const int mDamage; }; #endif /* DG_BULLET_H_ */ diff --git a/source/items/Weapon.cpp b/source/items/Weapon.cpp index 52bf026..1e2d696 100755 --- a/source/items/Weapon.cpp +++ b/source/items/Weapon.cpp @@ -34,5 +34,5 @@ Weapon::fire() { std::shared_ptr Weapon::createParticle() { return std::shared_ptr(new Bullet(mHolder.getPosition(), mWorld, mBulletTexture, - mHolder, mHolder.getAngle())); + mHolder, mHolder.getAngle(), 10)); }