Something like this?
http://www.angelfire.com/80s/phaelax/cloth_simulation.htm
That's DBP though, I had a simple version for classic, probably closer to the one you had, but the file was hosted on RGT. I'll try to see if I can find it.
Here's mine:
set display mode 800,600,32
sync on
autocam off
hide mouse
load bitmap "pyramid.bmp"
set current bitmap 0
for x=0 to 15
get image x+1,x*32,0,(x+1)*32,256
next x
backdrop on
make matrix 1, 1000,1000,10,10
for t=1 to 16
make object sphere t,2
color object t, rgb(255,0,0)
hide object t
next t
for t=1 to 16
make object plain t+20, 100,100
` position object t+20,t*10,100,200
texture object t+20,t
next t
`hide object 21
waveStrength# = 10.0
waveAmount# = 40.0
waveSpeed# = 10.0
spacing# = 10.0
maxPoint# = 2.0
offsetx# = 0.0
offsety# = 100.0
offsetz# = 200.0
DO
for t=1 to 16
if t<=maxPoint# then q=t
fz#=cos(wrapvalue(fa#-t*waveAmount#))*((q-1)*waveStrength#)
position object t, t*spacing#+offsetx#,offsety#,fz#+offsetz#
if t>1
if object position z(t)>object position z(t-1)
tanx#=abs(object position x(t) - object position x(t-1))
tanz#=abs(object position z(t) - object position z(t-1))
xpos#=object position x(t-1)+tanx#/2
zpos#=object position z(t-1)+tanz#/2
angle# = wrapvalue(atanfull(tanx#,tanz#)-90)
dist# = sqrt(tanx#^2 + tanz#^2)
else
tanx#=abs(object position x(t) - object position x(t-1))
tanz#=abs(object position z(t) - object position z(t-1))
xpos#=object position x(t-1)+tanx#/2.0
zpos#=object position z(t-1)-tanz#/2.0
angle# = 360-wrapvalue(atanfull(tanx#,tanz#)-90)
` angle#=asin(tanz#/dist#)
dist# = sqrt(tanx#^2 + tanz#^2)
endif
scale object t+20,dist#,80,100
else
if object position z(t)>offsetz#
tanx#=abs(object position x(t) - offsetx#)
tanz#=abs(object position z(t) - offsetz#)
xpos#=offsetx#+tanx#/2.0
zpos#=offsetz#+tanz#/2.0
angle# = wrapvalue(atanfull(tanx#,tanz#)-90)
dist# = sqrt(tanx#^2 + tanz#^2)
else
tanx#=abs(object position x(t) - offsetx#)
tanz#=abs(object position z(t) - offsetz#)
xpos#=offsetx#+tanx#/2.0
zpos#=offsetz#-tanz#/2.0
angle# = 360-wrapvalue(atanfull(tanx#,tanz#)-90)
` angle#=asin(tanz#/dist#)
dist# = sqrt(tanx#^2 + tanz#^2)
endif
scale object t+20,dist#,80,100
endif
position object t+20,xpos#+offsetx##,offsety#,zpos#+offsetz#
yrotate object t+20,wrapvalue(angle#+qfa#)
next t
fa#=wrapvalue(fa#+waveSpeed#)
if scancode()=30 then fa#=wrapvalue(fa#+waveSpeed#)
if scancode()=44 then fa#=wrapvalue(fa#-waveSpeed#)
gosub player_controls
gosub camera_status
set cursor 0,0
print "angle: ", fa#
t=2
tanx#=object position x(t) - object position x(t-1)
tanz#=abs(object position z(t) - object position z(t-1))
angle# = wrapvalue(atanfull(tanx#,tanz#)-90)
print angle#
sync
LOOP
PLAYER_CONTROLS:
if shiftkey()=1 then runspeed#=6.0
if upkey()=1
x#=newxvalue(x#,a#,6+runspeed#)
z#=newzvalue(z#,a#,6+runspeed#)
endif
if downkey()=1
x#=newxvalue(x#,a#,-6-runspeed#)
z#=newzvalue(z#,a#,-6-runspeed#)
endif
if leftkey()=1
x#=newxvalue(x#,wrapvalue(a#-90.0),5.0+runspeed#)
z#=newzvalue(z#,wrapvalue(a#-90.0),5.0+runspeed#)
endif
if rightkey()=1
x#=newxvalue(x#,wrapvalue(a#+90.0),5.0+runspeed#)
z#=newzvalue(z#,wrapvalue(a#+90.0),5.0+runspeed#)
endif
RETURN
CAMERA_STATUS:
rem rotate camera according to mouse
a#=wrapvalue(a#+(mousemovex()/3.0))
rem position and rotate camera
cxa#=cxa#+(mousemovey()/3.0)
if cxa#<-90.0 then cxa#=-90.0
if cxa#>90.0 then cxa#=90.0
position camera x#,y#+150,z#
rotate camera wrapvalue(cxa#),a#,0
RETURN
Don't know who wrote this version, uses a matrix:
sync on : randomize timer()
rem MAKE THE NOISE
rem noise vars
roughness#=0.60
dim noise#(32,4)
dim noise2#(32,4)
rem make noise
gosub makenoise
rem transfer array
for x=0 to 32
for y=0 to 4
noise2#(x,y)=noise#(x,y)
next y
next x
rem make noise
gosub makenoise
rem precalculate
frames#=300
interpolation#=30
dim height#(8,4,frames#+interpolation#)
gosub precalc
rem load texture
load image "pyramid.bmp",1
rem make the matrix
make matrix 1,80,40,8,4
prepare matrix texture 1,1,8,4
for x=0 to 7
for z=0 to 3
set matrix tile 1,x,3-z,(z*8)+x+1
next z
next x
update matrix 1
rem make cylinder
make object cylinder 1,4
scale object 1,100,2000,100
xrotate object 1,90
color object 1,rgb(80,60,0)
rem set the camera
position camera 0,100,0
point camera 0,0,0
color backdrop rgb(200,200,200)
set text transparent
rem vars
t#=interpolation#
amplify#=4.0
rem DO LOOP
do
text 0,0,str$(screen fps())
rem movement
yrotate camera wrapvalue(camera angle y()+mousemovex())
xrotate camera wrapvalue(camera angle x()+mousemovey())
if mouseclick()=1 then move camera 2
if mouseclick()=2 then move camera -2
rem animate matrix
for x=0 to 8
for y=0 to 4
h#=((height#(x,y,int(t#))*(t#-int(t#)))+(height#(x,y,int(t#)+1)*((int(t#)+1)-t#)))
set matrix height 1,x,y,h#*amplify#
next y
next x
normalize(1,8,4,1,1,7,3)
update matrix 1
rem update var
t#=t#+2.0
if t#>=frames#+interpolation# then t#=interpolation#
sync
loop
precalc:
set text opaque
rem flag vars
scroll#=0.0
pf#=20.0
wf#=2.00
ff#=8.00
friction#=0.25
dim flagspeed#(16,4)
rem THE LOOP
for t=0 to frames#
dt#=0.0010
for q=1 to 100
for x=0 to 8
for y=0 to 4
rem Pressure force
xarray#=scroll#+x
if xarray#>31 then xarray#=xarray#-31
rem calculate pressure difference
pdif#=(noise2#(int(xarray#),y)*(xarray#-int(xarray#))+noise2#(int(xarray#)+1,y)*((int(xarray#)+1)-xarray#))-(noise#(int(xarray#),y)*(xarray#-int(xarray#))+noise#(int(xarray#)+1,y)*((int(xarray#)+1)-xarray#))
a#=pdif#*pf#
rem WIND PUSHING
a#=a#+(height#(x,y,t)*wf#*-1.00)
rem FLAG PULLING
count#=0
hdif#=0.0
for p=x-1 to x+1
for r=y-1 to y+1
if p<>x or r<>y
if p>=0 and p<=8
if r>=0 and r<=4
dif#=height#(p,r,t)-height#(x,y,t)
hdif#=hdif#+dif#
count#=count#+1
endif
endif
endif
next r
next p
rem average
hdif#=hdif#/count#
a#=a#+(hdif#*ff#)
rem friction
a#=a#-(friction#*flagspeed#(x,y))
rem calculate new speed and position
flagspeed#(x,y)=flagspeed#(x,y)+(a#*dt#)
height#(x,y,t)=height#(x,y,t)+(flagspeed#(x,y)*dt#)
if x=0 then height#(x,y,t)=0
next y
next x
rem update scroll var
scroll#=scroll#+(dt#*2.5)
if scroll#>=32 then scroll#=scroll#-32.0
next q
center text 320,200,"LOADING... "+str$(int((t/(frames#+interpolation#))*100.00))+"%"
sync
next t
rem make cubic interpolation
for t=frames# to frames#+interpolation#
for x=0 to 8
for y=0 to 4
yb#=height#(x,y,frames#)
yc#=height#(x,y,interpolation#)
ya#=height#(x,y,frames#)+((height#(x,y,frames#-1)-height#(x,y,frames#))*interpolation#)
yd#=height#(x,y,interpolation#)+((height#(x,y,interpolation#+1)-height#(x,y,interpolation#))*interpolation#)
part#=(t-frames#)/interpolation#
part2#=part#*part#
a0#=(yd#-yc#-ya#)+yb#
a1#=ya#-yb#-a0#
a2#=yc#-ya#
a3#=yb#
height#(x,y,t)=(a0#*part#*part2#)+(a1#*part2#)+(a2#*part#)+a3#
next y
next x
center text 320,200,"LOADING... "+str$(int((t/(frames#+interpolation#))*100.00))+"%"
sync
next t
return
makenoise:
s=4
rem calculate noise
repeat
for x=0 to 32 step s
for y=0 to 4 step s
x#=x : y#=y : s#=s
if s=4
noise#(x,y)=(rnd(2000)-1000)/1000.0
endif
if s<>4
rem centre
if x#/(2.0*s#)<>int(x#/(2.0*s#)) and y#/(2.0*s#)<>int(y#/(2.0*s#))
noise#(x,y)=((noise#(x-s,y-s)+noise#(x-s,y+s)+noise#(x+s,y-s)+noise#(x+s,y+s))/4.00)+(roughness#*((rnd(2000)-1000)/1000.0))
endif
rem side
if x#/(2.0*s#)=int(x#/(2.0*s#)) and y#/(2.0*s#)<>int(y#/(2.0*s#))
noise#(x,y)=((noise#(x,y-s)+noise#(x,y+s))/2.00)+(roughness#*((rnd(2000)-1000)/1000.0))
endif
rem side
if x#/(2.0*s#)<>int(x#/(2.0*s#)) and y#/(2.0*s#)=int(y#/(2.0*s#))
noise#(x,y)=((noise#(x+s,y)+noise#(x-s,y))/2.00)+(roughness#*((rnd(2000)-1000)/1000.0))
endif
endif
rem make seamless
if x=32 then noise#(x,y)=noise#(0,y)
next y
next x
s=s/2
until s=0
low#=100.00
for x=0 to 32
for y=0 to 4
if noise#(x,y)<low# then low#=noise#(x,y)
next y
next x
for x=0 to 32
for y=0 to 4
noise#(x,y)=noise#(x,y)-low#
next y
next x
rem make it max 1
high#=-100.0
for x=0 to 32
for y=0 to 4
if noise#(x,y)>high# then high#=noise#(x,y)
next y
next x
for x=0 to 32
for y=0 to 4
noise#(x,y)=noise#(x,y)/high#
next y
next x
return
rem NORMALIZE
function normalize(mat,mattilex,mattilez,bx,bz,ex,ez)
if bx<=0 then bx=1
if bz<=0 then bz=1
if ex>=mattilex then ex=mattilex-1
if ez>=mattilez then ez=mattilez-1
rem Use matrix normals to make it smooth
for z=bz to ez
for x=bx to ex
rem Get matrix heights
h8#=get matrix height(mat,x,z-1)
h4#=get matrix height(mat,x-1,z)
h#=get matrix height(mat,x,z)
h2#=get matrix height(mat,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 mat,x,z,nx#,ny#/6.0,nz#
next x
next z
update matrix mat
endfunction
