Sunday, November 11, 2012

3D Bounce

graphsize 900,450
fastgraphics
vx=2
vy=3
vz=5
x=10
y=10
z=14
Loop:
color darkred
rect 0,0,900,450
color rgb(0,123,0)
poly{0,300,450,450,900,300,450,150}
color rgb(0,83,0)
poly{0,300,450,150,450,0,0,150}
color rgb(0,103,0)
poly{900,300,450,150,450,0,900,150}
color red
vz=vz-.05
x=x+vx
y=y+vy
z=z+vz
vz=vz-.05
h=(x+y)*cos(1/3)
v=300-(-x+y)*sin(1/3)
if x>465 then vx=-vx
if x<0 then vx=-vx
if y>465 then vy=-vy
if y<0 then vy=-vy
if z<0 then vz=-vz
color black
rect h,v,10,2
color red
circle h,v-z,10
refresh
clg
goto Loop