FIX: Pong timing

This commit is contained in:
Patrick Haßel 2023-01-09 10:18:27 +01:00
parent 1d0c3c0c1c
commit 8a7ddb006c

View File

@ -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;
}
};