diff options
| author | Justin <[email protected]> | 2018-12-23 22:04:10 -0500 |
|---|---|---|
| committer | Justin <[email protected]> | 2018-12-23 22:04:10 -0500 |
| commit | 8f34b3a0c7118abb81526a3dc5f435ba8f8485f8 (patch) | |
| tree | b5ab6cd9da851df515744fa455f801595dca963d | |
| parent | bca879db94bc6395dbfa77628747080311fdb226 (diff) | |
| download | shiftos-rewind-8f34b3a0c7118abb81526a3dc5f435ba8f8485f8.tar.gz shiftos-rewind-8f34b3a0c7118abb81526a3dc5f435ba8f8485f8.tar.bz2 shiftos-rewind-8f34b3a0c7118abb81526a3dc5f435ba8f8485f8.zip | |
Pong's CPU updated, But, don't know if it is impossible to beat. I haven't beat it yet
| -rw-r--r-- | ShiftOS.Main/Apps/Pong.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ShiftOS.Main/Apps/Pong.cs b/ShiftOS.Main/Apps/Pong.cs index aa0c792..cde3c31 100644 --- a/ShiftOS.Main/Apps/Pong.cs +++ b/ShiftOS.Main/Apps/Pong.cs @@ -47,16 +47,27 @@ namespace ShiftOS.Main.Apps ball.Top -= (int)ballY; ball.Left -= (int)ballX; - cpuPaddle.Top += speed; + - if (cpuPaddle.Top < 0 || cpuPaddle.Top > this.Height) speed = -speed; + //CPU + if (ballX < 0) + { + if (ball.Top < cpuPaddle.Top + 51) + { + cpuPaddle.Top -= 5; + } + if(ball.Top > cpuPaddle.Top + 51) + { + cpuPaddle.Top += 5; + } + } if (ball.Left < 0) { ResetToRest(); ballX = -ballX; } - if (ball.Left + ball.Width > this.Height) + if (ball.Left + ball.Width > this.Width) { ResetToRest(); ballX = -ballX; |
