heres one with crappy gravity
Rem Project: indi plane
Rem Created: 03/09/03 11:01:13
rem ----------------------------------------
rem ----------------------------------------
rem PROGRAM NAME INDIS WIDDLE AIRPWAYNE
rem author INDI
rem info A SIMPLE PLANE EXAMPLE
rem date SEPTEMBER 3 2003
rem
rem credits to The Darthster for memblock sin wave sound idea
rem and shift matrix solution
rem david 89 and red-eye for matrix smoothing
rem ----------------------------------------
rem ----------------------------------------
rem SETUP
rem ----------------------------------------
sync on : sync rate 60 : autocam off : hide mouse
set text size 13 : set text font "verdana" : set text to bold
color backdrop rgb(0,0,0)
set camera range 1,9000
if fog available() =1
fog on
fog distance 9000
endif
rem ----------------------------------------
rem DECLARE VARIABLES
rem ----------------------------------------
rem ----------------------------------------
rem INIT MEDIA
rem ----------------------------------------
ink rgb(0,155,0),1
box 0,0,32,32
for i = 1 to 200
ink rgb(0,rnd(155)+100,0),1
dot rnd(32),rnd(32)
next i
get image 1,0,0,31,31
cls
make matrix 1,20000,20000,40,40
position matrix 1,-10000,0,-10000
prepare matrix texture 1,1,1,1
randomize matrix 1,5000
update matrix 1
smooth_matrix(1,40,40,2)
rem Use matrix normals to make it smooth
`for z=1 to 39
` for x=1 to 39
rem Get matrix heights
` h8#=get matrix height(1,x,z-1)
` h4#=get matrix height(1,x-1,z)
` h#=get matrix height(1,x,z)
` h2#=get matrix height(1,x,z)
rem Calculate projected angle X using heights
` x1#=(x-1)*25.0 : y1#=h#
` x2#=(x+0)*25.0 : y2#=h4#
` dx#=x2#-x1#
` dy#=y2#-y1#
` ax#=atanfull(dx#,dy#)
` ax#=wrapvalue(90-ax#)
rem Calculate projected angle Z using heights
` z1#=(z-1)*25.0 : y1#=h2#
` z2#=(z+0)*25.0 : y2#=h8#
` dz#=z2#-z1#
` dy#=y2#-y1#
` az#=atanfull(dz#,dy#)
` az#=wrapvalue(90-az#)
rem Make normal from projected angle
` nx#=sin(ax#)
` ny#=cos(ax#)
` nz#=sin(az#)
rem Setting matrix normal for smoothness
` set matrix normal 1,x,z,nx#,ny#,nz#
` next x
`next z
update matrix 1
update matrix 1
rem the body
make object cube 1,1
scale object 1,75,75,400
position object 1,0,0,0
color object 1, rgb(255,0,0)
rem the top wing
make object cube 100,1
scale object 100,500,15,40
make mesh from object 1,100
delete object 100
add limb 1,1,1
offset limb 1,1,0,0.8,0.3
color limb 1,1,rgb(255,0,0)
rem the bottom wing
make object cube 100,1
scale object 100,500,15,40
make mesh from object 1,100
delete object 100
add limb 1,2,1
offset limb 1,2,0,-0.5,0.3
color limb 1,2,rgb(255,0,0)
rem the tail wing
make object cube 100,1
scale object 100,250,15,20
make mesh from object 1,100
delete object 100
add limb 1,3,1
offset limb 1,3,0,0.3,-0.5
color limb 1,3,rgb(255,0,0)
rem the propellar
make object cube 100,1
scale object 100,30,200,10
make mesh from object 1,100
delete object 100
add limb 1,4,1
offset limb 1,4,0,0,0.6
rem the tail rudder
make object cube 100,1
scale object 100,10,100,20
make mesh from object 1,100
delete object 100
add limb 1,5,1
offset limb 1,5,0,1,-0.5
color limb 1,5,rgb(255,0,0)
rem landing gear left
make object cube 100,1
scale object 100,50,50,50
make mesh from object 1,100
delete object 100
add limb 1,6,1
offset limb 1,6,1,-0.5,0.3
color limb 1,6,rgb(255,0,0)
rem landing gear right
make object cube 100,1
scale object 100,50,50,50
make mesh from object 1,100
delete object 100
add limb 1,7,1
offset limb 1,7,-1,-0.5,0.3
color limb 1,7,rgb(255,0,0)
make memblock 1,12+1378
write memblock dword 1,0,352800
write memblock dword 1,4,1378
write memblock dword 1,8,10
for i#=0.0 to 1377.0
write memblock byte 1,i#+12,int((sin(i#*16.71)*((sin(i#*190.91)*50)+(sin(i#*90.91)*50)+(sin(i#*160.43)*27)))+128)
next i#
make sound from memblock 1,1
loop sound 1
a=300
speed# = 15
rem ----------------------------------------
rem PRE MAIN
rem ----------------------------------------
`set shadow shading on 1
set light range 0,16000
position object 1,0,5000,0
ink rgb(255,255,255),1
rem ----------------------------------------
rem MAIN
rem ----------------------------------------
disable escapekey
while escapekey()=0
if leftkey()=1 then roll object left 1,1.0
if rightkey()=1 then roll object right 1,1.0
if upkey()=1 then pitch object down 1,1
if downkey()=1 then pitch object up 1,1
if inkey$()="[" then turn object left 1,1
if inkey$()="]" then turn object right 1,1
if shiftkey()=1
speed# = speed# +0.1
endif
if shiftkey()=0
speed# = speed# -0.01
if speed# < 0.0 then speed# = 0.0
endif
move object 1,speed#
if speed# < 10
position object 1,Object position x(1),Object position y(1)-1,Object position z(1)
endif
if speed# < 8
position object 1,Object position x(1),Object position y(1)-2,Object position z(1)
endif
if speed# < 6
position object 1,Object position x(1),Object position y(1)-3,Object position z(1)
endif
if speed# < 4
position object 1,Object position x(1),Object position y(1)-4,Object position z(1)
endif
if object position x(1)>500
position object 1,object position x(1)-500,object position y(1),object position z(1)
shift matrix left 1
update matrix 1
endif
if object position x(1)<-500
position object 1,object position x(1)+500,object position y(1),object position z(1)
shift matrix right 1
update matrix 1
endif
if object position z(1)>500
position object 1,object position x(1),object position y(1),object position z(1)-500
shift matrix up 1
update matrix 1
endif
if object position z(1)<-500
position object 1,object position x(1),object position y(1),object position z(1)+500
shift matrix down 1
update matrix 1
endif
r = wrapvalue(r + 8 + speed#)
rotate limb 1,4,0,0,r
set sound speed 1,300+(speed#*5)
position camera Object position x(1),Object position y(1)+5,Object position z(1)-25
point camera Object position x(1),Object position y(1),Object position z(1)
rem ----------------------------------------
rem DEBUG OUTPUT
rem ----------------------------------------
box 11,11,INT(speed#),21
text 10,30,"speed"+STR$(speed#)
text 10,50,"FPS:"+STR$(screen fps())
text 10,70,"y"+STR$(Object position y(1))
sync
endwhile
rem ----------------------------------------
rem CLEAN UP
rem ----------------------------------------
delete matrix 1
delete object 1
end
function smooth_matrix(matnum,tilex,tilez,times)
for multiple=1 to times
for x=1 to tilex-1
for z=1 to tilez-1
a=get matrix height(matnum,x-1,z+1)
b=get matrix height(matnum,x,z+1)
c=get matrix height(matnum,x+1,z+1)
d=get matrix height(matnum,x+1,z)
e=get matrix height(matnum,x+1,z-1)
f=get matrix height(matnum,x,z-1)
g=get matrix height(matnum,x-1,z-1)
h=get matrix height(matnum,x-1,z)
total=a+b+c+d+e+f+g+h
av#=total/8
set matrix height matnum,x,z,av#
next z
next x
next multiple
for x=0 to tilex
set matrix height matnum,x,0,get matrix height(matnum,x,1)
next x
for x=0 to tilex
set matrix height matnum,x,tilez,get matrix height(matnum,x,tilez-1)
next x
for z=0 to tilez
set matrix height matnum,0,z,get matrix height(matnum,1,z)
next z
for z=0 to tilez
set matrix height matnum,tilex,z,get matrix height(matnum,tilex-1,z)
next z
update matrix matnum
endfunction