aboutsummaryrefslogtreecommitdiffstats
path: root/src/gameplay.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-11 17:04:34 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-11 17:04:34 +0100
commit0f52cc0373370d639b8de42c7c9551da0db86d52 (patch)
tree35c270760a1d9b3b1c11e3a3b55268aac464d1ea /src/gameplay.cpp
parentmouselook on shotgun (diff)
downloadthreshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.gz
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.bz2
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.xz
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.zst
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.zip
clang-format chromium test
Diffstat (limited to '')
-rw-r--r--src/gameplay.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp
index 3a3d09b..9017de0 100644
--- a/src/gameplay.cpp
+++ b/src/gameplay.cpp
@@ -158,16 +158,6 @@ void Game::draw()
}
-int Game::getDiff(Vector2 pos, Vector2 tip, Vector2 target) const
-{
- if(((tip.x-pos.x)*(target.y-pos.y)-(tip.y-pos.y)*(target.x-pos.x))<0)
- return -1;
- if(((tip.x-pos.x)*(target.y-pos.y)-(tip.y-pos.y)*(target.x-pos.x))>0)
- return 1;
-
- return 0;
-}
-
// progress the game & check for player death
// NEW: go towards player NEXT: spawn at different furyTimes
int Game::tick() const
@@ -222,7 +212,7 @@ int Game::tick() const
if (en->hp != 0 && // check for player death (one shot one kill)
CheckCollisionCircles((Vector2){player->posX, player->posY}, 10,
(Vector2){en->posX, en->posY}, 40)) {
- std::cout << "cool" << std::endl;
+ return (1);
}
}
return (0);
@@ -263,14 +253,7 @@ int Game::getKeys() const
if (IsKeyDown(KEY_TWO)) {
player->currentWeapon = player->wp[1];
}
- if (IsKeyDown(KEY_LEFT)) {
- player->direction = Vector2Rotate(player->direction, -0.1f); // left
- }
- if (IsKeyDown(KEY_RIGHT)) {
- player->direction = Vector2Rotate(player->direction, 0.1f);
- }
- if (IsKeyPressed(KEY_SPACE)) {
- std::cout << "key space";
+ if (IsKeyPressed(KEY_SPACE) || IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
if (shoot()) {
return (0);
}
@@ -280,14 +263,12 @@ int Game::getKeys() const
}
if (player->threshold)
{
- if (GetTime() >= (player->furyTime + 5))
- {
+ if (GetTime() >= (player->furyTime + 5)) {
player->fury = 0;
player->threshold = false;
}
if (oldX != player->posX ||
- oldY != player->posY)
- {
+ oldY != player->posY) {
if (this->tick()) {
return (1);
}