diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-07 00:21:25 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-07 00:21:25 +0100 |
commit | e5b95c4b1559adac1283360903941350acc72e0e (patch) | |
tree | 0da038bed7fd9dba1f60e8296b5fc0a9c54682d1 /src/gameplay.cpp | |
parent | weapon as an abstract class. now make more weapons (diff) | |
download | threshold-e5b95c4b1559adac1283360903941350acc72e0e.tar.gz threshold-e5b95c4b1559adac1283360903941350acc72e0e.tar.bz2 threshold-e5b95c4b1559adac1283360903941350acc72e0e.tar.xz threshold-e5b95c4b1559adac1283360903941350acc72e0e.tar.zst threshold-e5b95c4b1559adac1283360903941350acc72e0e.zip |
almost there
Diffstat (limited to '')
-rw-r--r-- | src/gameplay.cpp | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp index effd26d..d60c5ca 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -253,55 +253,14 @@ int Game::getKeys() const int Game::shoot() const { - auto rot1 = Vector2Rotate(player->direction, -0.2f); - auto rot2 = Vector2Rotate(player->direction, 0.2f); - auto add1 = Vector2Add((Vector2){player->posX, player->posY}, rot1); - auto add2 = Vector2Add((Vector2){player->posX, player->posY}, rot2); - - auto r = player->direction; - r.x *= 2; - r.y *= 2; if (player->wp->empty == true) { return (0); } - if (player->wp->bang() == 1) { - player->wp->empty = true; + player->wp->bang(enemies, player->direction, (Vector2){player->posX, player->posY}); + if (player->wp->empty == true) { player->reloadTime = GetTime(); - return (0); - } - for (auto en = enemies->begin(); en != enemies->end(); en++) - { - 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}, r), (en->radius * 2)) || - CheckCollisionPointLine((Vector2){en->posX, en->posY}, (Vector2){player->posX, player->posY}, add2, (en->radius * 2))) - { // enemy hit - en->hp--; - if (en->hp == 0) - { - en->direction.x = (player->direction.x / 2); - en->direction.y = (player->direction.y / 2); - player->victims++; - } - player->fury++; - DrawLineEx((Vector2){player->posX, player->posY}, add1, 10, - ORANGE); - DrawLineEx((Vector2){player->posX, player->posY}, - Vector2Add((Vector2){player->posX, player->posY}, - r), - 10, ORANGE); - DrawLineEx((Vector2){player->posX, player->posY}, add2, 10, - ORANGE); - 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}, - r), - 10, ORANGE); - DrawLineEx((Vector2){player->posX, player->posY}, add2, 10, ORANGE); return (0); } |