Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: Hotshot on January 05, 2009
-
Dim As Integer x,y,choice
Locate 25,55
Print "press Esc key to exit...";
Do
x=Rnd * 80
Y=Rnd * 25
Locate y,x
choice=Rnd(1)
Select Case As Const Choice
Case 0
Color 10
Print "1";
Case 1
Color 2
Print "0";
End Select
Loop Until Inkey = Chr(27)
:)
-
Cool :)
Use the extended ascii set and scroll them down the screen and it will look pretty authentic :)
-
it looks nice and it surely could be imroved with some other characters and motion.
continue coding ;)
Ps. you forgot to put it to sleep :P
End Select
Loop Until Inkey = Chr(27)
should be
End Select
sleep 1
Loop Until Inkey = Chr(27)
or this one (correct me someone if i'm wrong with this, it's the first time i'm doing it)
DIM SHARED AS DOUBLE OLD,DV
Dim As Integer x,y,choice
Locate 25,55
Print "press Esc key to exit...";
Do
x=Rnd * 80
Y=Rnd * 25
Locate y,x
choice=Rnd(1)
OLD=TIMER
Select Case As Const Choice
Case 0
Color 10
Print "1"
Case 1
Color 2
Print "0"
End Select
sleep 1
DV=TIMER-OLD
Loop Until Inkey = Chr(27)
-
Sleep (time in millisecs) pauses your program and returns some time to the operating system, it's good practice to do this as Bikerboy said.