pong: reset counter on idle and increase idle length

This commit is contained in:
Trianta 2024-12-30 17:15:41 -06:00
parent 3aaa6740f4
commit 225e5e8422

View File

@ -256,10 +256,11 @@ class PongCore {
// Randomly move the bot paddle when ball not towards it
botIdle(player: Paddle) {
if (player.idleCounter < 10) {
player.idleCounter++;
player.idleCounter++;
if (player.idleCounter < 20)
return;
}
else
player.idleCounter = 0;
let direction: number = Math.floor(Math.random() * 3);
switch (direction) {
case 0: