bradgrantham-apple2e/COLORBOUNCE.A
2016-11-18 23:25:03 -08:00

21 lines
711 B
Plaintext

400 GR : REM SET COLOR GRAPHICS AREA
420 HOME : REM CLEAR TEXT AREA
440 X = 0: REM SET STARTING POSITION OF BACK-AND-FORTH VARIABLE
460 Y = 5: REM SET STARTING POSITION OF UP-AND-DOWN VARIABLE
480 XV = 2: REM SET X VELOCITY
500 YV = 1: REM SET Y VELOCITY
520 REM CALCULATE NEW POSITION
540 NX = X + XV:NY = Y + YV
560 REM IF BALL EXCEEDS SCREEN EDGE, THEN BOUNCE
580 IF NX > 39 THEN NX = 39:XV = - XV
600 IF NX < 0 THEN NX = 0:XV = - XV
620 IF NY > 39 THEN NY = 39:YV = - YV
640 IF NY < 0 THEN NY = 0:YV = - YV
660 REM PLOT NEW POSITION
680 COLOR= 7: PLOT NX,NY
700 REM ERASE OLD POSITION
720 COLOR= 0: PLOT X,Y
740 REM SAVE CURRENT POSITION
760 X = NX:Y = NY
780 GOTO 540