10 REM - REDEYES2.BAS.txt

20 GOSUB 1000 : REM Clear the Screen
30 PI = 3.14159
40 DZOP "C",1 : REM Color mode [Range = 16-23]
50 XC = 128 : YC = 128 : REM Initial center of the Eyes
60 REM Set colors for the Eyes and Dot
70 RC = 17 : REM Red color for the circles (eyes)
80 GC = 18 : REM Green color for the blinking dot
100 FOR STEPS = 1 TO 1000 : REM Loop to keep eyes wandering
110 GOSUB 4000 : REM Move the eyes to a new random position
120 GOSUB 2000 : REM Draw the red circles (eyes)
130 GOSUB 2300 : REM Blink the green dot
140 GOSUB 3000 : REM Pause between moves
150 GOSUB 1000 : REM Clear the screen
160 NEXT STEPS
999 GOTO 10 : REM Loop back to the beginning for continuous run
1000 REM Clear the Screen Routine
1010 DZOP "Z" : REM Clear screen
1020 RETURN
2000 REM Draw Red Eyes (Circles ON)
2010 DZOP "C",RC : REM Set color for eyes (red)
2020 GOSUB 2100 : REM Draw left eye
2030 GOSUB 2200 : REM Draw right eye
2095 RETURN
2100 REM Draw Left Almond-Shaped Eye
2110 FOR T = 0 TO (2*PI) STEP .1
2120 X = XC-30 + 20 * COS(T) : Y = YC + 10 * SIN(T)
2130 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D
"
2140 NEXT T
2150 RETURN
2200 REM Draw Right Almond-Shaped Eye
2210 FOR T = 0 TO (2*PI) STEP .1
2220 X = XC+30 + 20 * COS(T) : Y = YC + 10 * SIN(T)
2230 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D
"
2240 NEXT T
2250 RETURN
2300 REM Blink Green Dot in the Center of Both Eyes
2310 FOR BLINK = 1 TO 2
2320 DZOP "C",GC : REM Set color to green for blinking dot
2330 DZOP "P", XC-30, YC : DZOP "D" : REM Draw green dot in the center of left e
ye
2340 DZOP "P", XC+30, YC : DZOP "D" : REM Draw green dot in the center of right
eye
2350 GOSUB 3000 : REM Short pause to simulate blink
2360 DZOP "C",RC : REM Redraw the red eyes (to erase the green dot)
2370 DZOP "P", XC-30, YC : DZOP "D" : REM Redraw left red eye
2380 DZOP "P", XC+30, YC : DZOP "D" : REM Redraw right red eye
2390 GOSUB 3000 : REM Short pause to simulate blink off
2400 NEXT BLINK
2410 RETURN
3000 REM Pause Routine
3010 FOR PAUSE = 1 TO 200 : NEXT PAUSE : REM Short pause
3020 RETURN
4000 REM Move the Eyes to a New Random Position
4010 XC = INT(RND(1)*160) + 48 : YC = INT(RND(1)*160) + 48 : REM Random position
 within screen bounds
4020 RETURN
9999 REM End of Program
10000 GOTO 10
