diff options
Diffstat (limited to '')
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | src/gameplay.cpp | 14 |
2 files changed, 31 insertions, 5 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..dffa4c1 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# project BUFMEZ (aka threshold) + +This is a small work in progress game. This was made using [raylib](http://raylib.com) + +As this is a way for me to have fun, I decided to recreate something similar to SUPERHOT, but in two dimensions. + +Most of the prototype features are done, but it is currenty very barebones. + +Feel free to fork & add features. + +## Work In progress + +- Visual improvements + +- Better Level System + +## Future work + +- Music + +- Optimizations on vectors (too many function calls) + diff --git a/src/gameplay.cpp b/src/gameplay.cpp index decbd74..f52f665 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -124,11 +124,16 @@ int Game::getKeys() const player->direction = Vector2Rotate(player->direction, 0.1f); } if (IsKeyPressed(KEY_SPACE)) { + 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); for (auto en = enemies->begin(); en != enemies->end(); en++) { - if (CheckCollisionPointLine((Vector2){en->posX, en->posY}, (Vector2){player->posX, player->posY}, Vector2Add((Vector2){player->posX, player->posY}, Vector2Rotate(player->direction, -0.2f)), (en->radius * 2)) || + 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}, Vector2Rotate(player->direction, 0.0f)), (en->radius * 2)) || - CheckCollisionPointLine((Vector2){en->posX, en->posY}, (Vector2){player->posX, player->posY}, Vector2Add((Vector2){player->posX, player->posY}, Vector2Rotate(player->direction, 0.2f)), (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; @@ -137,9 +142,9 @@ int Game::getKeys() const return (0); } } - DrawLineEx((Vector2){player->posX, player->posY}, Vector2Add((Vector2){player->posX, player->posY}, Vector2Rotate(player->direction, -0.2f)), 10, ORANGE); + DrawLineEx((Vector2){player->posX, player->posY}, add1, 10, ORANGE); DrawLineEx((Vector2){player->posX, player->posY}, Vector2Add((Vector2){player->posX, player->posY}, player->direction), 10, ORANGE); - DrawLineEx((Vector2){player->posX, player->posY}, Vector2Add((Vector2){player->posX, player->posY}, Vector2Rotate(player->direction, 0.2f)), 10, ORANGE); + DrawLineEx((Vector2){player->posX, player->posY}, add2, 10, ORANGE); } if (player->threshold) { @@ -155,7 +160,6 @@ int Game::getKeys() const return (1); } } - aimer.x = (player->direction.x / 3); aimer.y = (player->direction.y / 3); DrawLineEx((Vector2){player->posX, player->posY}, Vector2Add((Vector2){player->posX, player->posY}, aimer), 5, GREEN); |