From 5a377187183e88a8953b64ec558e4dc9df9703b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asr=C4=B1n=20Do=C4=9Fan?= <33391270+Syntriax@users.noreply.github.com> Date: Sun, 29 Sep 2019 23:16:51 +0300 Subject: [PATCH] Replaced bytes with ints --- SynGame.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SynGame.c b/SynGame.c index 5b9b645..14db756 100644 --- a/SynGame.c +++ b/SynGame.c @@ -83,7 +83,7 @@ struct Vector2D position; char health; float moveSpeed; - byte lookDirection; + int lookDirection; int shootPerSecond; float shootCooldown; unsigned int killedEnemyCount; @@ -129,8 +129,8 @@ void BulletCollisions(); void DestroyGame(); void DestroyGameWindow(); -byte isVectorExceedingLimits(Vector2D vector, Vector2D limits); -byte CheckCollision(Vector2D *firstPos, Vector2D *secondPos, Image *firstMap, Image *secondMap); +int isVectorExceedingLimits(Vector2D vector, Vector2D limits); +int CheckCollision(Vector2D *firstPos, Vector2D *secondPos, Image *firstMap, Image *secondMap); float VectorMagnitude(Vector2D vector); float VectorDistanceBetween(Vector2D vectorFirst, Vector2D vectorSecond); @@ -200,9 +200,9 @@ int enemyLimiter = 12; Vector2D input; -byte isRestart = 0; -byte isRunning = 1; -byte isGameOver = 0; +int isRestart = 0; +int isRunning = 1; +int isGameOver = 0; void Update() { @@ -344,9 +344,9 @@ float VectorDistanceBetween(Vector2D vectorFirst, Vector2D vectorSecond) return VectorMagnitude(difference); } -byte isVectorExceedingLimits(Vector2D vector, Vector2D limits) +int isVectorExceedingLimits(Vector2D vector, Vector2D limits) { - byte result = vector.x > limits.x || vector.x < 0 || vector.y > limits.y || vector.y < 0; + int result = vector.x > limits.x || vector.x < 0 || vector.y > limits.y || vector.y < 0; return result; } @@ -355,9 +355,9 @@ byte isVectorExceedingLimits(Vector2D vector, Vector2D limits) And compares the distance between those objects to the minimum distancce to check if they're colliding. It's the most simple and optimized way I can think of for a game like this. */ -byte CheckCollision(Vector2D *firstPos, Vector2D *secondPos, Image *firstMap, Image *secondMap) +int CheckCollision(Vector2D *firstPos, Vector2D *secondPos, Image *firstMap, Image *secondMap) { - byte result; + int result; float minDistance; float distance;