§ Иллюстрация

Программа, которая рисует движущиеся звезды на QBasic

§ Код программы

SCREEN 13

TYPE Point3D
  x AS INTEGER
  y AS INTEGER
  z AS INTEGER
  c AS INTEGER
END TYPE

DIM star(0 TO 255) AS Point3D

FOR i = 0 TO 255

  star(i).x = RND * 256 - 128
  star(i).y = RND * 256 - 128
  star(i).z = RND * 128 + 16
  star(i).c = RND * 15 + 16

NEXT

PPD = 100

DO

  FOR i = 0 TO 255

    z = star(i).z
    x = 160 + PPD * star(i).x / z
    y = 100 - PPD * star(i).y / z
    PSET (x, y), 0

    z = z - 2
    IF z < 16 THEN z = z + 128
    star(i).z = z

    x = 160 + PPD * star(i).x / z
    y = 100 - PPD * star(i).y / z
    PSET (x, y), star(i).c

  NEXT

LOOP WHILE INKEY$ = ""