Computer Science Canada Help with Pong --> Paddle Movement. |
Author: | RsX [ Sun Apr 02, 2006 2:21 am ] | ||
Post subject: | Help with Pong --> Paddle Movement. | ||
I have a problem with paddle movement code. As you can see I set the main user to use 'A' to move up and 'Z' to move down. Player 2 uses 'K' to move up and 'M' to move down. There are 2 problems with this. 1) The movement is cut off, random, doesnt work at times, slow and inefficient. 2) Player 2 cannot move at all for some reason... Thank you in advance to all those who help!!!
P.S. I have a smaller problem that isnt as urgent... Is it possible to add background sounds? (processes within loops and ifs?) It wont let me for some reason. |
Author: | RsX [ Sun Apr 02, 2006 4:26 am ] |
Post subject: | |
NVM I got the sound fixed. But I still need help with the big problem.. For some reason player 2 works when I remove the player 1 code.... Anyone have any ideas? ![]() Help is greatly appreciated! |
Author: | Tony [ Sun Apr 02, 2006 4:32 am ] |
Post subject: | |
because getch() reads only 1 key at a time. Go ahead, try it - reply to this post and hold down two letter keys, see what happens? That's what your program sees. if you want to register multiple button presses, you need to use Input.KeyDown |
Author: | RsX [ Sun Apr 02, 2006 4:33 am ] |
Post subject: | |
How do you use that? Can you maybe write sample code or something if u have time? ![]() |
Author: | Tony [ Sun Apr 02, 2006 4:42 am ] |
Post subject: | |
[Turing Tutorials] is the place to be. I've tried to explain Input.KeyDown |