Do I need to use CLS?
Do I need to use CLS?
(OP)
I'm writing a maze game where you walk through it and looks like 3-d although its only a crude use of the LINE command really. However, evertime I move forward in the maze, I use the CLS command and then redraw all the lines to show the new view. It works but its jerky (i.e. noticeable delay) and looks messy as a result. I've tried redrawing the lines with the background colour (to blank them out) and then redrawing the new view (therefore not using CLS) but this is still jerky.
Any thoughts on how I might make this better? Many thanks.
1st post by the way and a newbie programmer to Qbasic.
Any thoughts on how I might make this better? Many thanks.
1st post by the way and a newbie programmer to Qbasic.
RE: Do I need to use CLS?
RE: Do I need to use CLS?
If a man says something in the forest and no woman hears it is he still wrong?
RE: Do I need to use CLS?
wait &h3da, 8
i try to avoid this, as it greatly slows down programs.
this is also faster.
line (0,0)-(319, 199), bf, 0
RE: Do I need to use CLS?
SCREEN 9
SCREEN , , 0, 1 'hides the screen, writing to background
drawmaze
SCREEN , , 1, 0 'switches the screens making the background now visible
x = 1
y = 1
WHILE a% > 1
a% = INP(96) 'keyboard routine
IF a% = 77 THEN
playery% = playery% - 1
ELSEIF a% = 75 THEN playery% = playery% + 1
ELSEIF a% = 80 THEN playerx% = playerx% - 1
ELSEIF a% = 72 THEN playerx% = playerx% + 1
END IF
PCOPY 0, 1 'copies the active screen to the background screen
SCREEN , , 0, 1 'switches so that background in being written to
drawmaze
SCREEN , , 1, 0 ' switches background and foreground again
WEND
If a man says something in the forest and no woman hears it is he still wrong?
RE: Do I need to use CLS?
RE: Do I need to use CLS?
SCREEN 12
LINE (MAZE)-(LINES),RED,B
LINE (MAZE)-(LINES),RED,B
LINE (MAZE)-(LINES),RED,B
[user/computer movement command entered]
LINE (MAZE)-(LINES),BLACK,B
LINE (MAZE)-(LINES),BLACK,B
LINE (MAZE)-(LINES),BLACK,B
LINE (NEW)-(LINES),RED,B
LINE (NEW)-(LINES),RED,B
LINE (NEW)-(LINES),RED,B
This way only the old lines get "eraced" when you are moving through the maze, removing that terrible "flashing" in between movements. More work? Yes, unless you have a program to generate the LINE values:
LINE (A,B)-(C,D),4,B
LINE (A,B)-(C,D),0,B
LINE (E,F)-(G,H),4,B
Like that. A more simple cure if I do say so!
Doug