' Falldown ' By Allan Crossman ' Based on Dorthod's version of the same game. ' Move with 4 and 6, quit with escape or mouse button. ' The keys can be altered below: leftkey$ = "4" rightkey$ = "6" quitkey$ = chr$(27) ' (escape) minchanceofbrick = 0.15 ' Higher is harder. increasetime = 500 ' ie after 500 ticks the chance increases increaseamount = 0.01 ' by 0.01 maxchanceofbrick = 0.5 hide console hidecursor fullscreen mode screen width, screen height, 8 disable break randomize timer width = 400 depth = 300 blockwidth = 20 blockheight = 5 left = screen width / 2 - (width / 2) top = screen height / 2 - (depth / 2) right = screen width / 2 + (width / 2) bottom = screen height / 2 + (depth / 2) disable done backcolor 0, 0, 0 forecolor 0, 65535, 0 virtue = init screen(0, 0, width, depth) Restart: chanceofbrick = minchanceofbrick if score > highscore then highscore = score score = 0 set screen to virtue cls x = width / 2 y = 20 copyrect 0, 0, width, depth, left, top, right, bottom, 0, virtue, 0 tick = 0 mainloop: starttime = timer set screen to console textmode 0 forecolor 65535, 65535, 0 text left, top - 30, "Score: " + str$(score) + " " text right - 100, top - 30, "High: " + str$(highscore) set screen to virtue tick = tick + 1 score = score + 1 if tick mod increasetime = 0 then chanceofbrick = chanceofbrick + increaseamount if chanceofbrick > maxchanceofbrick then chanceofbrick = maxchanceofbrick get pixel x, y + 2, r, g, b if g then y = y - 1 else y = y + 1 if y < 3 then wait 1 : goto Restart if y > depth - 3 then y = depth - 3 keymap scan if keymap key (leftkey$) then x = x - 1 if keymap key (rightkey$) then x = x + 1 if x < 3 then x = 3 if x > width - 3 then x = width - 3 copyrect 0, 1, width, depth, 0, 0, width, depth - 1, 0, virtue, virtue if tick mod blockheight = 0 then for n = 1 to blockwidth if rnd < chanceofbrick then forecolor 0, 65535, 0 blockleft = (n - 1) * ((width / blockwidth)) blockright = n * (width / blockwidth) line blockleft, depth - 1, blockright, depth - 1 else forecolor 0, 0, 0 blockleft = (n - 1) * ((width / blockwidth)) blockright = n * (width / blockwidth) line blockleft, depth - 1, blockright, depth - 1 end if next n else if tick mod blockheight = blockheight - 1 then forecolor 0, 0, 0 line 0, depth - 1, width, depth - 1 end if end if ' We do the copyrect to the console in two stages so that we can ' draw the player as soon as it's been drawn over (reducing flicker) copyrect 0, 0, width, y + 3, left, top, right, top + y + 3, 0, virtue, 0 set screen to console forecolor 65535, 0, 0 rect left + x - 3, top + y - 3, left + x + 3, top + y + 3 set screen to virtue copyrect 0, y + 3, width, depth, left, top + y + 3, right, bottom, 0, virtue, 0 if button or keymap key (quitkey$) then goto EndProg KillTime: if abs(timer - starttime) < 0.01 then goto KillTime goto mainloop EndProg: wait 1 set screen to console kill screen virtue normal screen showcursor end