+ Reply to Thread
Results 1 to 4 of 4

Pong Excel Game - Timing issue

  1. #1
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Pong Excel Game - Timing issue

    I have the attached excel games file. Please ignore the Tic-Tac-Toe and Hangman sheets.

    I am trying to make a pong game in Excel, as kind of a mental excercise. I think I have this more or less working, except for a timing issue.

    I have the following bit of code:
    Please Login or Register  to view this content.
    This part in particular is giving me trouble
    Please Login or Register  to view this content.
    When I set my BallMoveTime to 0.000005, the system is busy the whole time and I cannot move the player bar with the arrow key. When I set it to 0.000006, I can move the bar just fine, but the ball moves very sluggishly. So, I began to add digits to the BallMoveTime to see if there was a happy medium between being unable to move and the ball being too slow.

    There is not, seemingly. It seems like when I move the BallMoveTime past some mysterious increment, it changes to either too fast or too slow. There is no gradual shift.

    Can anyone help me either make the code more efficient, or adjust the timing so that the game runs smoothly?

    Thanks.
    Attached Files Attached Files
    Last edited by Whizbang; 06-08-2010 at 03:03 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Pong Excel Game - Timing issue

    Check out Andrew Engwirda's Rocket game for clues on how to handle keyboard input and screen updating.

    http://blog.livedoor.jp/andrewe/arch...at_107032.html

    I think the problem with you OnTime is a rounding issue. The method is not designed to take such small values.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Pong Excel Game - Timing issue

    Ok. Solved. Thank you so much for that link. Looks like quite a playground, both as a programmer and a gamer.

    Attached is the fixed version of the game. I plan on adding levels of difficulty and the like, but the foundation is there.
    Attached Files Attached Files
    Last edited by Whizbang; 06-15-2010 at 01:46 PM. Reason: Updating file.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Pong Excel Game - Timing issue

    For Excel related games have a look at
    http://www.dzikosoft.com/

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1