aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalaaad2 <47527723+salaaad2@users.noreply.github.com>2022-01-12 19:59:29 +0100
committerGitHub <noreply@github.com>2022-01-12 19:59:29 +0100
commitf34a37a54219dfc6f7ec6b9d4ed29be07ea9142f (patch)
tree4237e4726fa0040fcd61ffe7c4abc7518b8c6a38
parentfix player leaving the map (diff)
parentstages now work as intended, with multiple waves : \[v0.0.9\] (diff)
downloadthreshold-f34a37a54219dfc6f7ec6b9d4ed29be07ea9142f.tar.gz
threshold-f34a37a54219dfc6f7ec6b9d4ed29be07ea9142f.tar.bz2
threshold-f34a37a54219dfc6f7ec6b9d4ed29be07ea9142f.tar.xz
threshold-f34a37a54219dfc6f7ec6b9d4ed29be07ea9142f.tar.zst
threshold-f34a37a54219dfc6f7ec6b9d4ed29be07ea9142f.zip
Merge branch 'master' into master
-rw-r--r--meta/maps/stage_1_start.bfm2
-rw-r--r--src/gameplay.cpp18
-rw-r--r--src/gameplay.hpp4
3 files changed, 19 insertions, 5 deletions
diff --git a/meta/maps/stage_1_start.bfm b/meta/maps/stage_1_start.bfm
index c243e84..601bc8f 100644
--- a/meta/maps/stage_1_start.bfm
+++ b/meta/maps/stage_1_start.bfm
@@ -1,4 +1,4 @@
BOSS 0 0
ENEMIES 20 20
-WAVES 1 20
+WAVES 2 10
NEXT stage_1_1.bfm
diff --git a/src/gameplay.cpp b/src/gameplay.cpp
index cedc084..de4ba66 100644
--- a/src/gameplay.cpp
+++ b/src/gameplay.cpp
@@ -56,7 +56,7 @@ Game::Game(std::string const& path) : current(path) {
}
ifs.close();
enemies = new std::vector<Entity>;
- for (auto i = 0; i < nEnemies; i++) {
+ for (auto i = 0; i < nPerWave; i++) {
if (ehp == 0) {
Entity en(ehp);
en.radius = radius;
@@ -152,7 +152,7 @@ void Game::draw() {
// progress the game & check for player death
// NEW: go towards player NEXT: spawn at different furyTimes
-int Game::tick() const {
+int Game::tick() {
auto target = GetMousePosition();
DrawLine(player->posX, player->posY, target.x, target.y, RAYWHITE);
@@ -164,6 +164,20 @@ int Game::tick() const {
player->direction = v2;
+ if (player->victims == nPerWave && nWaves > 1) {
+ nWaves--;
+ std::cout << "DEBUG : waves left [" << nWaves << std::endl;
+ std::cout << "DEBUG : victims [" << nWaves << std::endl;
+ for (int i = 0 ; i < nPerWave; i++) {
+ Entity en(1);
+ en.radius = 20;
+ en.idleTex = LoadTexture(SBIRE_TEX_IDLE);
+ en.hurtTex = LoadTexture(SBIRE_TEX_HURT);
+ enemies->push_back(en);
+ std::cout << "DEBUG : spawn new enemy [" << i << std::endl;
+ }
+ }
+
for (auto en = enemies->begin(); en != enemies->end(); en++) {
if (en->hp > 0) {
if (en->posX >= SCREENWIDTH || en->posX <= 0) {
diff --git a/src/gameplay.hpp b/src/gameplay.hpp
index 3a4f4cb..a759f42 100644
--- a/src/gameplay.hpp
+++ b/src/gameplay.hpp
@@ -69,8 +69,8 @@ class Game {
void start();
void draw();
- int tick() const;
- int getKeys() const;
+ int tick() ;
+ int getKeys() ;
int shoot() const;
int hit(Entity en, Vector2 add1, Vector2 add2) const;