Computer Science Canada Pong |
Author: | Junkhead [ Mon Mar 20, 2006 12:33 pm ] |
Post subject: | Pong |
This is my first game programmed in Turing, it's a recreation of Pong in turing, complete with old school graphics too =) I planned to have netplay, but instead I settled for a really cheap AI. So, ignore the client option, just use Server instead. |
Author: | pavol [ Mon Mar 20, 2006 4:22 pm ] |
Post subject: | |
first thing you might want to look in is to make the computer beatable , also the paddle can go off the screen, and you should include a score somewhere. otherwise it's pretty good for a first game |
Author: | person [ Mon Mar 20, 2006 7:55 pm ] |
Post subject: | |
1) My paddle can co past the top adn bottom of the screen. 2) It doesn't say I loose if the ball misses my paddl. 3) Have a score/level system. 4) It's pretty amazing for a first game, keep up the good work |
Author: | Junkhead [ Thu Mar 23, 2006 1:00 pm ] |
Post subject: | |
New version! All of the problems are solved, and I've added a second game mode. Problem is, I cant get the timer to work correctly in the second game mode. Any help would be wonderful |
Author: | TheOneTrueGod [ Thu Mar 23, 2006 4:58 pm ] |
Post subject: | |
Hey, nice work. Good job with descriptive variable names For the timer, alls you gotta do is use Time.Elapsed. From what I gather, Time.Sec just returns the current time of day, so thats not really useful. Time.Elapsed gives you the amount of milliseconds that have passed since you started the program. Now, you might ask "How is that useful?", Or, you might not. Depends on how you think. What you gotta do is, have a timer variable (In the case of your code, timer). Right when you are about to start the loop to play the game, use timer := Time.Elapsed. Then, instead of outputting jus timer, do the following: locate(1,1) put "Time: ",Time.Elapsed - timer This will output the amount of milliseconds that have passed since they started the round. If you wanted to reset that counter when the ball passes through your "goal", just set timer to Time.Elapsed again when you lose. Now, the hard part comes in when you want to output the time in proper format. I'll leave part of it up to you, but i'll give you a couple big hints. First of all, timer should be an int, or else the Time.Elapsed method will not work. Second of all, I prefer to just use put, because otherwise you'll have to go through the label creation thing, and I think it only accepts strings. (Start off with put, and use the GUI if you feel like it / can get it to work with integers [use intstr()]). Third of all, to convert the time from milliseconds to seconds, all you have to do is output timer div 1000 Now, you know that the time in seconds is timer div 1000 and the time in milliseconds is timer I'll leave you to work on the equation for that |
Author: | Junkhead [ Fri Mar 24, 2006 12:28 pm ] |
Post subject: | |
Thanks a lot man, I was able to make the timer thanks to your advice. I owe you one |
Author: | FakeSound [ Sat May 06, 2006 12:03 pm ] |
Post subject: | |
I'm also trying to make a Pong game ... its not gonna be the traditional one, its gonna be something new, but i can't figure a few things out ... I'm kinda new to Turing, so i need to know a few things. a] i need to know how to make the ball move properly b] i need to know how to make boundaries for the ball c] i need to know how to make boundaries for the paddles that's all for right now .. any help will be appreciated |
Author: | TheOneTrueGod [ Sat May 06, 2006 2:29 pm ] |
Post subject: | |
Hello, the easiest thing to do for your questions would be to just review someone's old pong code. I'll give you some basic information, but It'll be much easier on yourself if you just read up on some old code. a]Have a variable that keeps track of the ball's speed. Increment the balls position by its speed every iteration. b]When the ball goes out of bounds (<0 or >maxx,<0 or > maxy) reverse the ball's speed (in the direction that it is going out of bounds). Ex if the ball exceeds maxy then make its y speed negative one (or whatever speed you feel most comfortable with. If you want, make it a variable speed, and just multiply the old speed by negative one.) c]When they press the key, make sure the paddle doesn't cross out of bounds. if it does, don't move it. otherwise, do. Simple as that good luck |
Author: | Clayton [ Sat May 06, 2006 6:22 pm ] |
Post subject: | |
what^he^said, also if you are looking to get into more complex coding, i suggest you look through the Turing Walkthrough, not only will it give you all of the info you need to do what you want to do, but a ton of info on just about anything else, good luck on your pong! |
Author: | Insectoid [ Wed Dec 07, 2011 7:02 pm ] |
Post subject: | RE:Pong |
Pong is one of the easiest games you can possibly make. There are hundreds of examples in the Submissions section (like this one!). Hell, OP even included all his source code! If you want someone to write it for you, well, that's not going to happen. There are plenty of freelance programmers who'd love a commission, if you have enough money, but you won't find those people here. |
Author: | copthesaint [ Wed Dec 07, 2011 7:35 pm ] |
Post subject: | RE:Pong |
NECROPOST! -_- lol Did you have to find the oldest pong out there? :p |
Author: | Tony [ Wed Dec 07, 2011 7:54 pm ] |
Post subject: | RE:Pong |
There was a legitimate necropost asking for solutions, which was deleted, but apparently not before you guys got the tabs opened. You can come hang out at http://compsci.ca/v3/viewtopic.php?t=30033 to see that assignment play out. |