Page 1 of 1

Crazy Balls

Posted: Tue Feb 17, 2015 4:47 am
by DrChip
REM Crazy Balls by 12 year old my son Digit
REM iPhone 6 / 8.0.3

graphics
DIM x(4),y(4),z(4),xd(4),yd(4)
FOR a=1 TO 3
READ x(a),y(a),z(a),xd(a),yd(a)
NEXT a

loop:
refresh off
graphics clear 0,0,0
mm=mm+.05
GOSUB balls
refresh on
GOTO loop

balls:
FOR a=1 TO 3
fill COLOR 0,0,1
fill CIRCLE x(a),y(a) size z(a)
fill COLOR 1,1,1
fill CIRCLE x(a),y(a) size z(a)
x(a)=x(a)+xd(a)
y(a)=y(a)+yd(a)
xd(a)=xd(a)+SIN(mm)/3
yd(a)=yd(a)+SIN(mm)/3
IF x(a)>Screen_Width()-z(a) THEN
xd(a)=-xd(a)
END IF
IF x(a)<0+z(a) THEN
xd(a)=-xd(a)
END IF
IF y(a)>Screen_Height()-z(a) THEN
yd(a)=-yd(a)
END IF
IF y(a)<0+z(a) THEN
yd(a)=-yd(a)
END IF
NEXT a
RETURN

DATA 10,10,5,0.5,0.5
DATA 10,10,7,1,1
DATA 10,10,9,1.5,1.5