Speeding up Pong

Speeding up Pong

Postby FatRatMatt » Thu Nov 03, 2011 9:14 am

Hi. My son and I are having a blast with the Hackvision games. Great job!
I played Pong with my brother in the 70s and remember that the speed of the ball increased if you had a long volley going. This made the game a bit more interesting and led to some epic games. I just looked through the code and with the exception of increasing dx to 2 or more, I can't figure out a way to speed the game up.
Any help would be appreciated.

Thanks, and again, great work!

Matt
FatRatMatt
Newbie
Newbie
 
Posts: 2
Joined: Thu Nov 03, 2011 9:09 am

Re: Speeding up Pong

Postby Michael » Sat Nov 05, 2011 12:37 pm

Try adjusting the line

tv.delay(2);

to a lower value. That should speed it up!
Michael
Administrator
Administrator
 
Posts: 477
Joined: Sat May 29, 2010 8:24 am

Re: Speeding up Pong

Postby FatRatMatt » Sat Nov 12, 2011 10:08 am

Thanks for that, but the delay(2) is just in the loop when you are waiting for someone to serve ( when dy == 0). A few lines down there is another delay, tv.delay(1), that would speed things up if you could change it to a lower value but it seems that it accepts integer values only. I tried commenting this line out and adding a delayMicroseconds line instead. This worked but made the screen flicker.
Any other ideas??

Thanks,

matt
FatRatMatt
Newbie
Newbie
 
Posts: 2
Joined: Thu Nov 03, 2011 9:09 am

Re: Speeding up Pong

Postby Michael » Wed Nov 16, 2011 8:43 am

Oops, you're right about the delay line. It's the tv.delay(1) that introduces the delay. There's probably not a good way to make it faster without having a lot of flicker. The timing is sensitive.

You could define dx and dy as floats instead of ints and set the values to something like 1.5. But the ball would appear to move at an uneven speed I think.

Sorry, Pong was really intended as a simple demo for paddle usage. Space Invaders and Asteroids are where I really invested a lot of time. There's also a nice new adventure game "Elventure" on the games page.
Michael
Administrator
Administrator
 
Posts: 477
Joined: Sat May 29, 2010 8:24 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest