For me, this is noteworthy.
The extensive use of gtriangle.
I did'nt really understand it before and never used it.
However, on with the show.
'X' to pull back plunger, pinball action.
Will you see the trick?
open window 640,512
peakshow=2 rem of 4 math displays
ballx=320
bally=420
hitx=320
hity=420
sunx=500
suny=100
ang=pi/180
r=25
arc=10
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
setrgb 1,256,256,256
setrgb 2,0,256,0
setrgb 3,0,256,0
gtriangle 640,512 to 0,450 to 640,450
setrgb 2,256,256,256
gtriangle 0,512 to 640,512 to 0,450
setrgb 2,0,0,256
setrgb 3,0,0,256
gtriangle 640,450 to 0,0 to 640,0
setrgb 2,256,256,256
gtriangle 0,450 to 640,450 to 0,0
for a=1 to 360 step arc
setrgb 2,200,200,50
setrgb 3,200,200,50
gtriangle sunx,suny to sin(ang*a)*r+sunx,cos(ang*a)*r+suny to sin(ang*(a+arc))*r+sunx,cos(ang*(a+arc))*r+suny
next a
if hity<450 then
hity=450
move=0
moveblok=0
endif
if hity>450 move=5
rem 'move simulates ball weight (greater, lighter)
if hity>490 hity=490
c=peek("port1")
if and(c,16384)>0 then
hity=hity+5
else
moveblok=moveblok+move
hity=hity-moveblok
endif
if hity-bally<30 start=moveblok
start=start-1
bally=bally-start
if bally>hity-30 then
bally=hity-30
start=-start*.9
rem multiplier simulates gravity. (1, no gravity)
endif
if bally>hity-31 then
recoil=start
recoil=recoil-.5
hity=hity+recoil
endif
setrgb 1,0,0,0
if peakshow=1 then
line 330,bally-r to 400,bally-r
text 340,bally-r-3,str$(int(height)-40)
endif
if peakshow=2 then
peak=450-bally
if start=0 height=peak
if bally=450 height=0
if peak>height newhite=peak
line 330,430-newhite to 400,430-newhite
text 340,430-newhite-3,str$(int(newhite)-40)
endif
if peakshow=3 then
peak=450-bally
if start=0 height=peak
if bally=450 height=0
if peak>height newhite=peak
setrgb 1,0,0,0
text 450,500,str$(int(newhite))
text 250,500,str$(int(start))
text 390,500,str$(int(height))
endif
if peakshow=4 then
setrgb 1,0,0,0
text 200,500,str$(move)
text 250,500,str$(moveblok)
text 390,500,str$(hity-bally)
endif
setrgb 1,256,256,0
fill rectangle hitx-10,hity-5 to hitx+10,hity+5
setrgb 1,0,0,0
rectangle hitx-10,hity-5 to hitx+10,hity+5
rem spring
for y=0 to 25 step 0.1
x=cos(y)
dot x*10+320,y*2*((500-hity)/50)+(hity+5)
next y
for a=1 to 360 step arc
setrgb 1,256,256,256
setrgb 2,256,0,0
setrgb 3,256,0,0
gtriangle ballx,bally to sin(ang*a)*r+ballx,cos(ang*a)*r+bally to sin(ang*(a+arc))*r+ballx,cos(ang*(a+arc))*r+bally
next a
until (1=0)