aboutsummaryrefslogtreecommitdiffstats
path: root/src/gameplay.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-05 18:38:15 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-05 18:38:15 +0100
commit902946fef868b2c9448532d616745b29356d6bfa (patch)
tree2db6c4fcd2ace2fecb8d6672a5e1693d4a15bc87 /src/gameplay.cpp
parentv0.0.3 onwards to better levels (diff)
downloadthreshold-902946fef868b2c9448532d616745b29356d6bfa.tar.gz
threshold-902946fef868b2c9448532d616745b29356d6bfa.tar.bz2
threshold-902946fef868b2c9448532d616745b29356d6bfa.tar.xz
threshold-902946fef868b2c9448532d616745b29356d6bfa.tar.zst
threshold-902946fef868b2c9448532d616745b29356d6bfa.zip
terrain is fukkkkd
Diffstat (limited to 'src/gameplay.cpp')
-rw-r--r--src/gameplay.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp
index 3adaa2d..d732a48 100644
--- a/src/gameplay.cpp
+++ b/src/gameplay.cpp
@@ -59,6 +59,7 @@ Game::~Game()
{
delete enemies;
delete player;
+ delete terrain;
}
void Game::start()
@@ -78,7 +79,9 @@ void Game::start()
void Game::draw() const
{
auto left = std::to_string(enemies->size());
+
ClearBackground(COOLPURPLE);
+
for (auto & en : *enemies)
{
DrawCircleV((Vector2){en.posX, en.posY}, en.radius, DARKBLUE);
@@ -87,10 +90,8 @@ void Game::draw() const
Rectangle destRec = { player->posX, player->posY, frameWidth * 1.4f, frameHeight * 1.4f };
// Origin of the texture (rotation/scale point), it's relative to destination rectangle size
-
DrawTexturePro(player->tex, sourceRec, destRec, origin, Vector2Angle((Vector2){0.0f, 0.0f}, player->direction), WHITE);
-
DrawText("Enemies left : ", 10, 10, 20, GREEN);
DrawText(left.c_str(), 150, 10, 20, RED);
if (player->fury >= 5) {
@@ -234,13 +235,10 @@ Game::shoot() const
if (CheckCollisionPointLine((Vector2){en->posX, en->posY}, (Vector2){player->posX, player->posY}, add1, (en->radius * 2)) ||
CheckCollisionPointLine((Vector2){en->posX, en->posY}, (Vector2){player->posX, player->posY}, Vector2Add((Vector2){player->posX, player->posY}, player->direction), (en->radius * 2)) ||
CheckCollisionPointLine((Vector2){en->posX, en->posY}, (Vector2){player->posX, player->posY}, add2, (en->radius * 2)))
- {
- std::cout << "hit enemy at " << en->posX << "|" << en->posY
- << std::endl;
+ { // enemy hit
en->hp = 0;
en->direction.x = (player->direction.x / 2);
en->direction.y = (player->direction.y / 2);
- // enemies->erase(en);
player->victims++;
player->fury++;
DrawLineEx((Vector2){player->posX, player->posY}, add1, 10,
@@ -254,6 +252,7 @@ Game::shoot() const
return (1);
}
}
+ // shotty cone
DrawLineEx((Vector2){player->posX, player->posY}, add1, 10, ORANGE);
DrawLineEx((Vector2){player->posX, player->posY},
Vector2Add((Vector2){player->posX, player->posY},