summaryrefslogtreecommitdiff
path: root/Shotgun.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Shotgun.cpp')
-rw-r--r--Shotgun.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Shotgun.cpp b/Shotgun.cpp
new file mode 100644
index 0000000..a265c26
--- /dev/null
+++ b/Shotgun.cpp
@@ -0,0 +1,24 @@
+#include "Shotgun.h"
+
+Shotgun::Shotgun() {
+ damage = 20;
+ speed = 5;
+ size = 1;
+ curProjectile = 0;
+ setImage("weapons.png");
+ setClip(0, 100, 0, 100, 50);
+}
+
+void Shotgun::attack() {
+ // Shoots 3 bullets in a row
+ for (int i = 0; i < 3; i++) {
+ projectiles[curProjectile].setX(getX() + 50);
+ projectiles[curProjectile].setY(getY() - 50 + (i * 30));
+ projectiles[curProjectile].setActive(true);
+ if (curProjectile < 9) {
+ curProjectile++;
+ } else {
+ curProjectile = 0;
+ }
+ }
+}