View Full Version : Help With DARK Basic
Nov 7, 2008, 01:48 PM
We are using dark basic in school to make primitive video games. Does anybody know how to make text display for a certain amount of time, and then go away. I need the text to display for a certain amount of time while still having the game run, but with text in the center of the screen for awhile.
Nov 7, 2008, 01:55 PM
Are we talking about a textbox or some text on top of your game? eg "game over" in the middle of your screen?
Nov 7, 2008, 01:58 PM
Here is a simple run down of the game. It is a pong remake. There are two paddles on the screen, one on the left, and one on the other side. I already have it so that whenever the ball hits the paddle, "BAM!!!" is displayed in the center of the screen. I have tried a pause command for the text, but that pauses the entire program, not just the text. Needless to say, that is a useless command. I want it so that the game is still in play, but "BAM!!!" is displayed in the center of the screen for like 3 seconds.
Nov 7, 2008, 02:07 PM
You apparently already have the ability to place graphics on the screen, why not place a graphic saying "Bam!" in the middle of the screen?
Nov 7, 2008, 02:18 PM
I dont know DarkBASIC, but this is typically how you solve such an issue:
1./ The game needs to have a timer or clock. Either this is provided by DarkBasic as an inbuilt variable, or you need to create your own "counter". That would be some variable that starts at zero and is increased every second (if you can do that), or increases by 1 every time the game "loops". The problem with the second approach is that depending on the speed of the CPU, the timing will go out of whack. I'm sure DarkBASIC can solve this with "real timers".
2./ You consider any "timed" event, like your message, to be an object with a time constraint
3./ Show it, either print, or use the sprite routines
4./ Set how long you want it to display, as either a countdown timer, or as a limit when the game-clock reaches that value
5./ Remove it when your counter reaches zero, or when the game-clock > limit
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.