Computer Science Canada Pong. |
Author: | eNc [ Fri Jan 21, 2005 9:54 am ] | ||
Post subject: | Pong. | ||
Hi umm yea I've made paddles for a ping game except they don't show up at the same time keys are w, s up and down arrows This is what i have so far
I don't know how I can make them visible at the same time. |
Author: | Tony [ Fri Jan 21, 2005 12:41 pm ] | ||
Post subject: | |||
because your pesudocode looks like
Not only is that horribly bad, but getch doesnt work for two player games because of key jamming (if I was to hold down a button, you would not be able to move) Use Input.KeyDown() instead |
Author: | basketball4ever [ Fri Jan 21, 2005 5:54 pm ] | ||
Post subject: | |||
i would suggest more like this
|
Author: | Leftover [ Fri Jan 21, 2005 8:02 pm ] | ||
Post subject: | |||
tony wrote: Not only is that horribly bad, but getch doesnt work for two player games because of key jamming (if I was to hold down a button, you would not be able to move) Use Input.KeyDown() instead
Did you not catch that part? Getch won't work if there are 2 people pressing keys at same time. It's only meant to get 1 key. A simple program like:
will only take input of 1 key and if you run it you will see. An AI or using InputKeyDown like tony said really is the only option for 2 players like that. |
Author: | Unreal_Origin [ Fri Jan 21, 2005 8:09 pm ] | ||||
Post subject: | |||||
hey how is it going, your problem is that you have two loops one at the start and one in the procedure i mod it a bit but here it is
that is if you want to keep getch if you want a better way then this is what i would suggest
|
Author: | eNc [ Sat Jan 22, 2005 10:57 am ] |
Post subject: | |
ohh ok thanks 10 bits to u |
Author: | eNc [ Sat Jan 22, 2005 11:42 am ] |
Post subject: | |
Sorry Double Post Can't Delete |
Author: | eNc [ Sat Jan 22, 2005 11:47 am ] | ||
Post subject: | |||
Check out the added code, is there anyway I can improve this?
|
Author: | cool dude [ Sat Jan 22, 2005 12:17 pm ] |
Post subject: | |
looking good so far. change the background colour, add a ball, make score, make a high score list, but so far good. also when u press enter to play the game the paddles don't show up until u hit the key. thats easy to fix. all u have to do is give a starting point to the paddles so draw them first. |
Author: | eNc [ Sat Jan 22, 2005 1:04 pm ] |
Post subject: | |
cool dude wrote: looking good so far. change the background colour, add a ball, make score, make a high score list, but so far good. also when u press enter to play the game the paddles don't show up until u hit the key. thats easy to fix. all u have to do is give a starting point to the paddles so draw them first.
thanks |
Author: | eNc [ Sat Jan 22, 2005 1:16 pm ] | ||
Post subject: | |||
I've created the ball, however now the paddles won't move and I'm not sure how to do hit detection of the paddles, here's the code
|
Author: | basketball4ever [ Sat Jan 22, 2005 1:18 pm ] |
Post subject: | |
maybe add a little bit of difficulty??? like possibly... how to complete a level. or like a random "point" thing comes out and you have to get it in a certain amount of time.... too much boring pong games out ![]() ![]() |
Author: | eNc [ Sat Jan 22, 2005 1:21 pm ] |
Post subject: | |
basketball4ever wrote: maybe add a little bit of difficulty??? like possibly... how to complete a level. or like a random "point" thing comes out and you have to get it in a certain amount of time.... too much boring pong games out
![]() ![]() lol yea but first things first i have to get it to work ![]() |
Author: | eNc [ Sat Jan 22, 2005 1:22 pm ] |
Post subject: | |
now i have some hit dection with the boxes, but they won't move... |
Author: | Bacchus [ Sat Jan 22, 2005 4:29 pm ] |
Post subject: | |
they wont move b/c you call the ball proc and then theres a loop in there, so it just keeps repeating that proc over and over. i sugest taking everything out of that proc and just stick it in ur main program |
Author: | Unreal_Origin [ Sat Jan 22, 2005 5:04 pm ] | ||
Post subject: | giveing my assistance again | ||
here you go this should fix that up
|
Author: | eNc [ Sat Jan 22, 2005 5:18 pm ] | ||
Post subject: | |||
Here's my code it check to see if it bounces, but it doesn't toally work
|
Author: | Unreal_Origin [ Sat Jan 22, 2005 6:30 pm ] |
Post subject: | or you could use what i gave you? |
yo i already posted you something that works. All you have to do is, redo the x coordinates so that it redraws the ball at the start and then point (x= 300, y = 300) then add a point to the other team, BUT if the paddle hits the ball it should bounce off. i don't want to program that for you, b/c i am to lazy |
Author: | Unreal_Origin [ Sat Jan 22, 2005 6:31 pm ] |
Post subject: | or you could use what i gave you? |
sry double post i it b/c of dial up |
Author: | Kyle [ Sat Jan 22, 2005 7:21 pm ] |
Post subject: | |
true the ball blinks and there is lag. I dont no if the first pong laged. i think my computer is also better then the old ones. you both need to fix some collision detection, but all in all there good. ![]() |
Author: | Unreal_Origin [ Sat Jan 22, 2005 7:31 pm ] |
Post subject: | if you actually read the posts |
hey if you read the posts you would see that i am letting them do it since i am to lazy to actually do it, also if you look at the one at the top their is no flicking anywho later |
Author: | eNc [ Sun Jan 23, 2005 2:37 pm ] | ||
Post subject: | |||
Ok here's my code, I doesn't do collision detection for the left paddle, I'm not sure why
|
Author: | Unreal_Origin [ Tue Jan 25, 2005 8:44 pm ] | ||
Post subject: | here you go colision detection | ||
hey so here it is
i would highly suggest using view.update since it flickers so much |
Author: | Pip_Jr [ Thu Feb 10, 2005 12:45 pm ] |
Post subject: | |
I Tryed your game... I couldn't move pattels and the ball moved to fast ![]() This got annoying after the 1000th time lol |