Computer Science Canada In my pong game, why does my left paddle work but not right? |
Author: | s_climax [ Sat Apr 24, 2004 5:08 pm ] | ||
Post subject: | In my pong game, why does my left paddle work but not right? | ||
My right paddle in my game works rather flawlessly, but for some reason my left does not. Sometimes the left paddle makes the shot. Other times it passes right through it. In my eyes, the left and right paddle's codes are identical. What is wrong with my coding? Another question that you may find easy to solve is how to I reduce the flickering?
|
Author: | Paul [ Sat Apr 24, 2004 5:19 pm ] |
Post subject: | |
Well, it was flashing so I took off vga and graphics in setscreen, dun think u need them anyway, and it stopped flashing. I like the color change in the ball. Well I'm too lazy to go thru all that code so Im just going to give u what I think. When I look at ur code, it looks like the other team gets a point if the ball hits the line. Your paddle is behind the line. It might be the random slope the ball gets everytime it hits (I really hate the random thing), so the increments bypass the checking. Say the paddle is at 5, the ball was at 8, it moves to 6, then it moves to 4, therefore passing the 5. So I dunno if u already have it, but make it so that it bounces off, if the ball is INSIDE the paddle. Another reason why this might not work is because of the line which ur checking from. The ball stops when it hits the line, since the line and the paddle are so close, the ball might bypass the paddle and hit the line, as I explained above. So try making the part of the code which checks if the ball hit a back wall bugproof by making the line and checking coordinates further away from the paddle. |
Author: | s_climax [ Sat Apr 24, 2004 6:02 pm ] |
Post subject: | |
Paul Bian wrote: Well, it was flashing so I took off vga and graphics in setscreen, dun think u need them anyway, and it stopped flashing.
Didn't work for me. Still flashed despite removing the 1st line. |
Author: | Paul [ Sat Apr 24, 2004 6:35 pm ] |
Post subject: | |
no, I didn't take off "offscreenonly" so its setscreen ("offscreenonly") |
Author: | s_climax [ Sat Apr 24, 2004 8:01 pm ] |
Post subject: | |
That worked. Thanks |
Author: | s_climax [ Tue Apr 27, 2004 7:14 pm ] | ||||||||
Post subject: | |||||||||
Okay. I think I figured out the problems.
should be
also, this:
should be this:
It now works fine after those changes. Thanks anyways. I jsut had to think it over a bit and pore through my code and I found those two. |
Author: | TheFreshPrince [ Wed May 05, 2004 4:04 pm ] |
Post subject: | |
from the original old program, the left paddle worked with the a and z keys |
Author: | s_climax [ Wed May 05, 2004 6:26 pm ] |
Post subject: | |
I know that. I wrote the code. My problem was that the collisions were different with the left paddle thatn with the right. |