Computer Science Canada Circular Pong |
Author: | iker [ Tue Jan 03, 2006 3:30 pm ] |
Post subject: | Circular Pong |
I'm currently working on a pong type single player game, and I need to figure out how to detect a collision along the whole paddle, or on the ball. I want it so that if you hit the left side of the paddle, the ball goes left, and if it hits the right side, it goes right, but also taking in to consideration the direction before. So say if the ball comes in at speed 2 from the left, and it hits the right side of the paddle, that adds a speed of 1 to the right. Any comments will help too, but for the most part I just need to know what type of collision would be best. Controls left/right:move paddle enter:start ball esc:quit game(also frees all the pics to gain back that lost memory...) |
Author: | MysticVegeta [ Tue Jan 03, 2006 5:54 pm ] |
Post subject: | |
Here! |
Author: | iker [ Tue Jan 03, 2006 6:43 pm ] |
Post subject: | |
Thnx, but I already know basic collision detection, and I've worked out a way, but its going to take a while. Anyways, be back soon with a finished first version. |
Author: | iker [ Wed Jan 04, 2006 2:14 pm ] |
Post subject: | |
I completed the first version, and It works perfectly fine, except a few minor glitches here and there, none that realy effect gameplay. Anyways, same controls as before, and I added a 'debug' mode where it shows you how the game works... sort of. During the game press alt + d and it will go into debug mode, same to get out. I completely changed the type of ball movement from before, now using sin and cos. There are three detections along each paddle. If the ball hits the center, 180degrees are added to the balls movement, sending it strait back, if it hits the left, something like 145 and the right, 215. Comments and suggestions would be greatly appreciated. Controls move: left/right arrows start: enter quit: esc |
Author: | cool dude [ Wed Jan 04, 2006 2:55 pm ] |
Post subject: | |
do u mind attaching it as a zip so i can see it, it looks interesting. if u can't then can u just email it to me please. thanks |
Author: | iker [ Thu Jan 05, 2006 12:16 am ] |
Post subject: | |
No problem, I had/have to upload a new one with a score counter that actualy works, and i fixed a 'glitch' where the ball will now reset when you exit and start again, instead of staying in the same spot. Deleated the second one because this one isn't much of an update, except for those two minor things. |
Author: | iker [ Thu Jan 05, 2006 8:48 pm ] |
Post subject: | |
I actualy just thought of this, can someone move this to the app page, because I don't need help nemore, and its an app, and i don't feel like making a new topic... |
Author: | Cervantes [ Thu Jan 05, 2006 10:03 pm ] |
Post subject: | |
iker wrote: can someone move this to the app page
Certainly. Pretty good game. I like the concept. The collisions could use some work, however; sometimes the ball will hit the right side of the paddle, and yet it will be pushed to the left, to which it bounces off the same paddle again and again... +10 bits |
Author: | Clayton [ Mon Jan 16, 2006 4:38 pm ] |
Post subject: | |
i found that the ball will sometimes "stick" to the paddle making uber points for the player and sometimes the ball doesnt quite bounce the right way but otherwise its great gj |
Author: | GlobeTrotter [ Mon Jan 16, 2006 7:09 pm ] | ||
Post subject: | |||
I had tried making a game similar to this. I kind of gave up on it, anyone who wants to can continue it. I found a fundamental flaw with the game. If the ball starts in the centre, and travels in a random direction, it will always just travel in along a straight line. I also could not quite figure out how to make the collisions properly. There are the very beginnings of bricks for my game too. I never got around to implementing them.
|
Author: | iker [ Mon Jan 16, 2006 7:17 pm ] |
Post subject: | |
Too bad I don't have the new turing or a math predef in my version of turing or else i would check that out for sure |
Author: | Delos [ Mon Jan 16, 2006 7:23 pm ] |
Post subject: | |
Not having those predefs is not a problem. Just make your own and change the code a little. After all, all that Math.Distance() is is Pythagorus' Theorem. |
Author: | iker [ Mon Jan 16, 2006 7:27 pm ] |
Post subject: | |
Delos wrote: Not having those predefs is not a problem. Just make your own and change the code a little. After all, all that Math.Distance() is is Pythagorus' Theorem.
I would, but I don't know what each part is in the Math.Distance (a, b, c, d) where as I do not know what a b c and d are supposed to be is it Math.Distance (x1, y1, x2, y2)? |
Author: | Cervantes [ Mon Jan 16, 2006 8:29 pm ] |
Post subject: | |
That is correct. Read up on extending turing |
Author: | codemage [ Tue Jan 17, 2006 1:21 pm ] |
Post subject: | |
Perhaps instead of 3 zones on the paddle, you could scale the angle of deflection more smoothly. If your deflection is between 145 to 215, Angle of deflection = 145 degs + (70 degrees * Percent of the way down the paddle) |