Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Pong With Single Player - Suggestions?
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
trevorprella




PostPosted: Sat Feb 21, 2009 3:42 pm   Post subject: Pong With Single Player - Suggestions?

Is there any way to shorten this a bit, because it took up alot of space to do the scores, and when youre writing text with a font, it wont let you put in integer variables. Is there any way to get around that?


pong.t
 Description:

Download
 Filename:  pong.t
 Filesize:  9.25 KB
 Downloaded:  166 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Sat Feb 21, 2009 3:49 pm   Post subject: Re: Pong With Single Player - Suggestions?

I have not looked at your code but to add integers into Font.Draw you have to convert them into a string with intstr.
So instead of just putting your variable put intstr(variable)
Edit:
I understand what you mean about the scoring. If you use intstr(p1s) or intstr(p2s) you should shorten it quite a bit.
trevorprella




PostPosted: Sat Feb 21, 2009 3:57 pm   Post subject: RE:Pong With Single Player - Suggestions?

Ok thanks
it works alot better now without the extra 50 lines of code
BigBear




PostPosted: Sat Feb 21, 2009 4:02 pm   Post subject: Re: Pong With Single Player - Suggestions?

You mean 68 in both single player and 2 player.

Also you need to make the AI not have the same y position as the ball.
Insectoid




PostPosted: Sat Feb 21, 2009 5:33 pm   Post subject: RE:Pong With Single Player - Suggestions?

What I did for my AI was check the ball's Y in relation to the AI paddle's Y. If it's greater, move the paddle up. If it's less, move it down. By varying the speed of the paddle I was able to make differing levels of difficulty.
saltpro15




PostPosted: Sat Feb 21, 2009 6:03 pm   Post subject: Re: Pong With Single Player - Suggestions?

here's my pong with AI, hope it helps


pong demo.t
 Description:

Download
 Filename:  pong demo.t
 Filesize:  4.43 KB
 Downloaded:  117 Time(s)

Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: