1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Help With DARK Basic

Discussion in 'Programming & Webmastering' started by dcf-joe, Nov 7, 2008.

  1. dcf-joe

    dcf-joe

    Joined:
    Feb 11, 2008
    Messages:
    403 (0.15/day)
    Thanks Received:
    26
    Location:
    Nebraska, USA
    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.
     
  2. DanTheBanjoman Señor Moderator

    Joined:
    May 20, 2004
    Messages:
    10,553 (2.60/day)
    Thanks Received:
    1,383
    Are we talking about a textbox or some text on top of your game? eg "game over" in the middle of your screen?
     
  3. dcf-joe

    dcf-joe

    Joined:
    Feb 11, 2008
    Messages:
    403 (0.15/day)
    Thanks Received:
    26
    Location:
    Nebraska, USA
    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.
     
  4. DanTheBanjoman Señor Moderator

    Joined:
    May 20, 2004
    Messages:
    10,553 (2.60/day)
    Thanks Received:
    1,383
    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?
     
  5. lemonadesoda

    lemonadesoda

    Joined:
    Aug 30, 2006
    Messages:
    6,317 (1.96/day)
    Thanks Received:
    976
    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
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page