#include #include "Weapon.h" #include "Projectile.h" Weapon::Weapon() { damage = 1; speed = 50; size = 1; curProjectile = 0; setImage("weapons.png"); setClip(0, 0, 0, 100, 50); } int Weapon::getDamage() { return damage; } int Weapon::getSpeed() { return speed; } int Weapon::getSize() { return size; } void Weapon::setDamage(int damage) { this->damage = damage; } void Weapon::setSpeed(int speed) { this->speed = speed; } void Weapon::setSize(int size) { this->size = size; } void Weapon::attack() { // Start the projectile at the end of the gun projectiles[curProjectile].setX(getX() + 50); projectiles[curProjectile].setY(getY() + 10); projectiles[curProjectile].setActive(true); // Use 10 projectiles then re-use from the beginning if (curProjectile < 9) { curProjectile++; } else { curProjectile = 0; } }