|
-
Feb 15th, 2001, 09:05 PM
#1
Thread Starter
Lively Member
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...

-
Feb 15th, 2001, 09:48 PM
#2
Frenzied Member
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."
-
Feb 15th, 2001, 09:50 PM
#3
Thread Starter
Lively Member
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...

-
Feb 15th, 2001, 09:52 PM
#4
Thread Starter
Lively Member
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...

-
Feb 15th, 2001, 09:58 PM
#5
Frenzied Member
Yes, it would be a good idea to store all those things.
Harry.
"From one thing, know ten thousand things."
-
Feb 15th, 2001, 10:02 PM
#6
Thread Starter
Lively Member
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...

-
Feb 15th, 2001, 10:10 PM
#7
Frenzied Member
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."
-
Feb 16th, 2001, 06:47 PM
#8
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|