about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-09 12:19:17 -0400
committerCharadon <dev@iotib.net>2022-06-09 12:19:17 -0400
commitb264623cb1e3c7484fabad546af7aed51d88b197 (patch)
tree9d007c3c92d001cc5594d4091dda51b8765b0de8 /src
parent5621db21d9896ab648b70a1a882e0b9f64cf003f (diff)
downloadPong-C-b264623cb1e3c7484fabad546af7aed51d88b197.tar.gz
Fixed a timing issue
Diffstat (limited to 'src')
-rw-r--r--src/ball.c2
-rw-r--r--src/enemy.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/ball.c b/src/ball.c
index 33b2d40..a3e63ab 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -10,7 +10,7 @@ void ball(Rectangle *Player, Rectangle *Enemy, struct Balls *Ball, int *PlayerSc
 	// Moves 
 	int CurrentTick = SDL_AtomicGet(&Ticks);
 	if(Ball->NextTick <= CurrentTick){
-		int RunThisManyTimes = 1;
+		int RunThisManyTimes = 0;
 		if (CurrentTick > Ball->NextTick) {
 			RunThisManyTimes = (CurrentTick - Ball->NextTick);
 			printf("%d\n",RunThisManyTimes);
diff --git a/src/enemy.c b/src/enemy.c
index 47e2438..56c7d87 100644
--- a/src/enemy.c
+++ b/src/enemy.c
@@ -3,7 +3,7 @@
 
 void enemy(struct Players *Enemy, struct Balls ball) {
 	int CurrentTick = SDL_AtomicGet(&Ticks);
-	int RunThisManyTimes;
+	int RunThisManyTimes = 0;
 	if (Enemy->NextTick <= CurrentTick) {
 		if(CurrentTick > Enemy->NextTick) {
 			RunThisManyTimes = (CurrentTick - Enemy->NextTick);