From 8a7ddb006c5ed3070679aa09660016af25f6a32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Mon, 9 Jan 2023 10:18:27 +0100 Subject: [PATCH] FIX: Pong timing --- src/mode/Pong/Pong.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mode/Pong/Pong.h b/src/mode/Pong/Pong.h index 36956f3..06d3170 100644 --- a/src/mode/Pong/Pong.h +++ b/src/mode/Pong/Pong.h @@ -43,6 +43,7 @@ public: protected: void tick(uint8_t index, milliseconds_t milliseconds) override { + Serial.printf("tick(%lu)\n", milliseconds); switch (status) { case SCORE: timeout -= milliseconds; @@ -57,8 +58,6 @@ protected: paddleBounce(); checkScoring(); topBottomBounce(); - - // TODO don't always markDirty. Be more efficient markDirty(); break; @@ -66,8 +65,8 @@ protected: timeout -= milliseconds; if (timeout <= 0) { resetPlayer(); - status = SCORE; - timeout = 2000000; + status = PLAY; + timeout = 0; } break; } @@ -126,7 +125,7 @@ private: } if (player0.score >= 10 || player1.score >= 10) { status = OVER; - timeout = 2000000; + timeout = 2000; } } @@ -146,7 +145,7 @@ private: velocity.x = direction; velocity.y = 0; status = SCORE; - timeout = 2000000; + timeout = 2000; } };