Does anyone know how to put a time, wait, or loop on a graphic. Im trying to right a game and on the title page, i have a graphic. I want it to wait about 5 seconds before it goes on. I've tried loops but it just flashs the images like 100 times before it continues and you cant even understand what its saying. If anyone knows a way to get around this please, let me know, THANKS,
pjw1987
Comments
:
: pjw1987
:
use a loop, but put the graphic in before the loop, not inside...
[code]
[b]Code Layout:[/b]
[red]>Display graphic here<[/red]
'To pause for 5 seconds...
StartTimer = TIMER
DO UNTIL TIMER - StartTimer >= 5: LOOP
[red]>Remove graphic and continue<[/red][/code]
SLEEP 5
In QBasic, the SLEEP statement allows you to stop program execution until the time specified as parameter passes. In this case, it will wait for 5 secs.
Note: The user can avoid the delay by pressing any key. It's very useful if you want that your image stay on screen until the user press a key, but dont delaying more than 5 secs.
Note 2: If you want that the program stay stopped until the user press a key, without any time limit, simply use SLEEP without parameters. Example:
PRINT "Press any key to continue . . ."
SLEEP 'will wait until user press a key
Note 3: The pressed key ill be returned ina future INKEY$ function. Then, to wait user press a key and then verify what key he pressed, instead of:
PRINT "Press a key..."
WHILE K$=""
K$=INKEY$
WEND
use this:
PRINT "Press a key..."
SLEEP
K$=INKEY$
Davi Medrade
Brazil.
PS: Sorry because my bad English. I can speak very well only Portuguese.
: Does anyone know how to put a time, wait, or loop on a graphic. Im trying to right a game and on the title page, i have a graphic. I want it to wait about 5 seconds before it goes on. I've tried loops but it just flashs the images like 100 times before it continues and you cant even understand what its saying. If anyone knows a way to get around this please, let me know, THANKS,
:
: pjw1987
:
Here is a sample program using a subroutine that will pause for approximately 5 seconds. Keystrokes will not mess you up. You may copy and paste it. Hope this helps ! Good Luck !!
print "This is now"
gosub haltRoutine
print "This is about 5 seconds later"
end
haltRoutine:
t$=time$
startSecond%=val(mid$(t$,7,2))
secondDiff%=0
do
t$=time$
currSecond%=val(mid$(t$,7,2))
secondDiff%=abs(currSecond%-startSecond%)
if secondDiff%> 4 then
exit do
end if
loop
return