Speeding up Pong

Store Forums Hackvision General Discussion Speeding up Pong

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #558
    FatRatMatt
    Member

    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

    #1185
    Michael
    Keymaster

    Try adjusting the line

    tv.delay(2);

    to a lower value. That should speed it up!

    #1199
    FatRatMatt
    Member

    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

    #1218
    Michael
    Keymaster

    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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.