QB64.org Forum
Active Forums => Programs => Topic started by: PMACKAY on April 08, 2022, 09:44:54 am
-
just messing around with smooth scrolling ascii text mode..
screendata$(holds then entire screen map) no need to print to screen. use mid$ to store x,y data instead to screendata$
adjust the timer to adjust speed of frame being drawn
in screen draw routine take out dr%=0 in line 65 to have continued scroll
to disable wrap around change line 43 to b$=" " and line 57 to a$=" "
Screen _NewImage(32 * 8, 24 * 16, 256)
Timer On
On Timer(0.0066) GoSub MVE:
Randomize Timer
Dim screendata$(24)
For i = 1 To 24
For j = 1 To 32
screendata$(i) = screendata$(i) + Chr$(Int(Rnd(1) * 26) + 65)
Next j
Print screendata$(i)
Next i
Cls
dr% = 0
ZX% = 8
Do:
If Int(Rnd(1) * 75500) = 100 Then GoSub RAND
I$ = InKey$
If I$ = "Q" Then dr% = 1: I$ = ""
If I$ = "E" Then dr% = 2: I$ = ""
If I$ = "W" Then dr% = 0: I$ = ""
Loop While I$ = ""
Timer Off
End
MVE:
If dr% = 0 Then
For i = 1 To 24
Color 1: _PrintString (ZX%, i * 16 - 15), screendata$(i)
Color 2: Locate i, 1: Print "Û";: Locate i, 32: Print "Û";
Next i
End If
If dr% = 1 Then
For i = 1 To 24
Color 1: _PrintString (ZX%, i * 16 - 15), screendata$(i)
Color 2: Locate i, 1: Print "Û";: Locate i, 32: Print "Û";
Next i
ZX% = ZX% - 1
If ZX% < 0 Then
For i = 1 To 24
A$ = Right$(screendata$(i), 31)
B$ = Left$(screendata$(i), 1)
screendata$(i) = A$ + B$
Next i
ZX% = 7
End If
End If
If dr% = 2 Then
For i = 1 To 24
Color 1: _PrintString (ZX%, i * 16 - 15), screendata$(i)
Color 2: Locate i, 1: Print "Û";: Locate i, 32: Print "Û";
Next i
ZX% = ZX% + 1
If ZX% > 8 Then
For i = 1 To 24
A$ = Right$(screendata$(i), 1)
B$ = Left$(screendata$(i), 31)
screendata$(i) = A$ + B$
Next i
ZX% = 1
End If
End If
_Display
dr% = 0
Return
RAND:
X = Int(Rnd(1) * 24 + 1)
Y = Int(Rnd(1) * 31 + 1)
Mid$(screendata$(X), Y, 1) = "\"
Return
-
@PMACKAY been awhile, welcome back!
-
I tried conjuring up Terry Richie, but I must have got my wires crossed. Oh well. It's a win either way.
Pete
-
I tried the program, but the printing of the 'strange' characters on lines 31 and 37, do not have a Linux equivalent... Can you describe what it is meant to look like? - Just a screen shot will be ok...
-
Just random junk (SCROLLS IF CAPS LOCK IS ON, Q OR E)
-
Ok... The scrolling is quite smooth... Cleverly done. I even like the colour!
May I suggest that, the colour parameters for lines 31, 37 and 52, be changed to "9". In my opinion this will enhance the look and feel... Moo Ha Ha...
-
its supposed to show junk. was just a test to smooth scroll the screen. the random was just to show you can print to the screen easy using a similar routine. you can all do as you wish this. it was me messing about as i like to play around making stuff up.
you can change the screen size and size of the scroll quiet easy to make a maze game or ascii side scroller. not difficult to convert to vertical
Screen _NewImage(40 * 8, 28 * 16, 256) and have it draw a box around the outside and paint it. that will give a border like a commodore64
you can change the font if you want also
screendata$(1) to screendata$(24) : just put in the data what you want eg. screendata$(?) = "your maze data". you can make a maze that you walk through but your man goes up and down why your scrolls in the direction you press make the map roll around and the maze harder.
you could make it draw a map and move monsters around like a PAC man why you gobble dots on a full rotating map. maybe remap the ASCII characters and print monsters chasing you. could maybe dig holes for monsters to fall in so you could run back over them but only dig a hole every 10 seconds. just a thought
it could be made to run much better but I like it.
everyone is right it is showing garbage. its on purpose as a demo. the random print of "/" is to show you how to locate x,y:print "whatever" as the screen updates on a timer. no need to print print: