diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-06 19:29:58 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-06 19:29:58 +0100 |
commit | d4ccc92a516372e614fde95bbcb69f41e2bb2f11 (patch) | |
tree | 5fac05bb6d86f3b95983d4c8cdedb42f2f44be89 /src/entity.cpp | |
parent | longer shotty range, add hit function which does not work (diff) | |
download | threshold-d4ccc92a516372e614fde95bbcb69f41e2bb2f11.tar.gz threshold-d4ccc92a516372e614fde95bbcb69f41e2bb2f11.tar.bz2 threshold-d4ccc92a516372e614fde95bbcb69f41e2bb2f11.tar.xz threshold-d4ccc92a516372e614fde95bbcb69f41e2bb2f11.tar.zst threshold-d4ccc92a516372e614fde95bbcb69f41e2bb2f11.zip |
more dynamic and faster enemy movement
Diffstat (limited to 'src/entity.cpp')
-rw-r--r-- | src/entity.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/entity.cpp b/src/entity.cpp index c68ff10..3b21557 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -17,34 +17,30 @@ Entity::Entity(void) : hp(1) case (0): { posX = GetRandomValue((SCREENWIDTH / 2) - 30, (SCREENWIDTH / 2) + 30); - posY = 0; + posY = GetRandomValue(0, 40); break; } case (1): { - posX = SCREENWIDTH; + posX = GetRandomValue(SCREENWIDTH - 20, SCREENWIDTH + 20); posY = GetRandomValue((SCREENHEIGHT / 2) - 30, (SCREENHEIGHT / 2) + 30); break; } case (2): { posX = GetRandomValue((SCREENWIDTH / 2) - 30, (SCREENWIDTH / 2) + 30); - posY = SCREENHEIGHT; + posY = GetRandomValue(SCREENHEIGHT - 20, SCREENHEIGHT + 20); break; } case (3): { - posX = SCREENWIDTH; + posX = GetRandomValue(SCREENWIDTH - 20, SCREENWIDTH + 20); posY = GetRandomValue((SCREENHEIGHT / 2), (SCREENHEIGHT / 2) + 10); break; } } - // if (static_cast<int>(posX) & 1) { - direction = (Vector2){0.1f, 0.1f}; - // } else { - // direction = (Vector2){-posX / 100, posY / 100}; - // } // old pseudo-random path finder. now reworking so that they go towards the player + direction = (Vector2){0.02f, 0.02f}; radius = 10; // default radius. this is changed later threshold = false; } |