StarCap/ProjectileWeapon.h
2021-04-27 14:42:08 -06:00

31 lines
694 B
C++

#include <utility>
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_PROJECTILEWEAPON_H
#define SFML_TEMPLATE_PROJECTILEWEAPON_H
class ProjectileWeapon : public Weapon {
public:
ProjectileWeapon(Projectile _proj, int frameDelay) : Weapon(frameDelay) {
projectile = std::move(_proj);
}
Shootable* shoot(const Ship* shooter) {
currentFrame = 0;
projectile.setDirection(shooter->getDirection());
projectile.setPosition(shooter->getPosition());
projectile.setShooter((GameSprite *) shooter);
Shootable *copied = new Shootable(projectile);
return copied;
}
};
#endif //SFML_TEMPLATE_PROJECTILEWEAPON_H