Results 1 to 8 of 8

Thread: Stuff getting erased...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Cool

    In this game I'm writing, a cross between that old (QBASIC?) monkey game and the similar tank version, when you start a new game a form comes up so you can set the number of players, each player's name and each player's tank color. Then I draw the city using a series of line methods for the buildings. Only problem is, their is a whole in the city where the form was. Also, if a tooltip or similar thing goes over any of the spaces I've drawn, that space is erased when the tooltip goes away. What gives???
    On Error Resume Screaming...

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    The reason it gets overwritten is simply because that area of video memory has been overwritten. You need to either redraw the graphics every time you think you might have to, or just redraw them constantly. The usual way to make games is to continuously redraw the image. That's how the FPS (frames per second) of a game when it runs is measured, it's the number of screen redraws per second.
    Harry.

    "From one thing, know ten thousand things."

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Unhappy Another thing..

    When I fire the tank's shot, before I place each pixel I check to see if it is the building color or any tank's color. Unfortunately, sometimes due to all the decimal places in the variables, a pixel gets placed twice and therefore the tank thinks it hits itself (each tank's shell is the same color as it's body). To counteract this, I make the shell color equal to the tanks's body color plus one. This works for some colors but for red it draws black for and some custom or weird colors, it draws a whole new color.
    On Error Resume Screaming...

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124
    Originally posted by HarryW
    The reason it gets overwritten is simply because that area of video memory has been overwritten. You need to either redraw the graphics every time you think you might have to, or just redraw them constantly. The usual way to make games is to continuously redraw the image. That's how the FPS (frames per second) of a game when it runs is measured, it's the number of screen redraws per second.
    That's a problem because the draw event uses random numbers, so if I call it again, I get a whole new city. I guess I could store the numbers though. I'll try that.
    On Error Resume Screaming...

  5. #5
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Yes, it would be a good idea to store all those things.
    Harry.

    "From one thing, know ten thousand things."

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124
    Actually, I don't think that will work.

    Whenever a tank shell lands, it explodes. This means that if I just put the buildings back, they won't be updated.

    How can I redraw every so many seconds with the updated image?
    On Error Resume Screaming...

  7. #7
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Well you can do it with GetTickCount creating a home-made timer.

    I would recommend that you record the positions of these explosion effects and just redraw them too. Draw the map, then the explosion marks, then the sprites (the tanks) and the shells in motion. I don't know how much games programming you plan to do, but that's the standard way it's done in all games.
    Harry.

    "From one thing, know ten thousand things."

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Cool

    Okay, I'll give it a shot.
    On Error Resume Screaming...

Posting Permissions

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



Click Here to Expand Forum to Full Width