1SCREEN 13
2
3' Set palette grayscale
4FOR i = 0 TO 63: OUT 968, i: OUT 969, i: OUT 969, i: OUT 969, i: NEXT
5
6' Starfeld
7FOR i = 1 TO 256: PSET (RND * 320, RND * 100), RND * 31: NEXT i
8
9LOCATE 2, 31: COLOR 47: PRINT "MoonLight"
10
11' Moon
12rx = 50: ry = 60
13
14CIRCLE (rx, ry), 15, 31, , , 1
15PAINT (rx, ry), 25, 31
16FOR i = 0 TO 3.14 STEP .01: PSET (rx + 8 * SIN(i), ry + 15 * COS(i)), 31: NEXT
17PAINT (rx + 12, ry), 53, 31
18
19FOR y = -30 TO 30
20FOR x = -30 TO 30
21  r = x ^ 2 + y ^ 2
22  IF r > 15 ^ 2 THEN
23    d = 45 - SQR(r) * 1.4
24    d = d + POINT(rx + x, ry + y)
25    IF d < 0 THEN d = 0
26    IF d > 63 THEN d = 63
27    PSET (rx + x, ry + y), d
28  END IF
29NEXT
30NEXT
31
32
33CONST p = 100
34CONST h = 5
35
36DO
37
38  FOR y = -100 TO -1
39  FOR x = -160 TO 160
40
41    zn = p * h / y
42    xn = x * h / y
43
44    ' Waves
45    dx = SIN(xn) * COS(t + zn)
46    dx = dx + SIN(2 * xn - t) * COS(3 * zn + t) / 2
47    dx = dx + SIN(3 * xn + t) * COS(.5 * zn - t)
48    dx = dx + SIN(.5 * xn + t) * COS(1.5 * zn + t)
49    dx = dx * 4
50
51    ' For fun only
52    dy = COS(xn) * SIN(zn) * 4
53
54    ' Reflection distort
55    nx = x + 160 + dx
56    ny = y + 100 + dy
57
58    r = POINT(nx, ny)
59    r = r * .75 + 4 + dx
60    r = 4 * r / SQR(ABS(zn))
61
62    IF nx < 0 OR nx > 319 OR ny < 0 AND ny > 100 THEN r = 0
63    IF r > 63 THEN r = 63
64    IF r < 0 THEN r = 0
65
66    PSET (160 + x, 100 - y), r AND 63
67
68  NEXT
69  NEXT
70
71  t = t + .1
72
73LOOP WHILE INKEY$ = ""