aboutsummaryrefslogtreecommitdiffstats
path: root/src/wp_enemyslingshot.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-13 19:21:04 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-13 19:21:04 +0100
commit0aad778336ef25336ca51611419b306aff9020ab (patch)
treee1d3c8b67cd028496e8803687754ccebf0cfd36b /src/wp_enemyslingshot.cpp
parentMerge pull request #1 from Paure42/master (diff)
downloadthreshold-0aad778336ef25336ca51611419b306aff9020ab.tar.gz
threshold-0aad778336ef25336ca51611419b306aff9020ab.tar.bz2
threshold-0aad778336ef25336ca51611419b306aff9020ab.tar.xz
threshold-0aad778336ef25336ca51611419b306aff9020ab.tar.zst
threshold-0aad778336ef25336ca51611419b306aff9020ab.zip
this is starting to get boring.ill see
Diffstat (limited to 'src/wp_enemyslingshot.cpp')
-rw-r--r--src/wp_enemyslingshot.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/wp_enemyslingshot.cpp b/src/wp_enemyslingshot.cpp
new file mode 100644
index 0000000..2a5b9fc
--- /dev/null
+++ b/src/wp_enemyslingshot.cpp
@@ -0,0 +1,41 @@
+#include "wp_enemyslingshot.hpp"
+
+#include <raylib.h>
+#include <raymath.h>
+#include <iostream>
+
+#include "gameplay.hpp"
+#include "entity.hpp"
+
+wp_enemysling::wp_enemysling(const char* s, const char* r)
+ : AWeapon(300.0f, 10, 2, 0.0, s, r) {}
+
+int wp_enemysling::bang(std::vector<Entity>* enemies, Entity* baddie) {
+ if (barrel == 0) {
+ return (1);
+ } else {
+ barrel--;
+ PlaySound(shot);
+ t = GetTime();
+ // enemysling spawns a new enemy every @reload seconds. thats it.
+ // it's a slingshot
+ //
+ Entity en(1);
+ en.posX = (baddie->posX += range);
+ en.posY = (baddie->posY += range);
+ en.direction = baddie->direction;
+ en.radius = 20;
+ en.currentWeapon = nullptr;
+ en.idleTex = LoadTexture(SBIRE_TEX_IDLE);
+ en.hurtTex = LoadTexture(SBIRE_TEX_HURT);
+ enemies->push_back(en);
+ std::cout << "push back enemy. so far so good " << std::endl;
+
+ //
+ // there
+ if (barrel == 0) {
+ empty = true;
+ }
+ return (0);
+ }
+}