sync on ropes=5 maxpoints=4 maxconnections=2 dim ropepoints(ropes) dim pointx#(ropes,maxpoints) dim pointy#(ropes,maxpoints) dim pointxvel#(ropes,maxpoints) dim pointyvel#(ropes,maxpoints) dim pointxdis(ropes,maxpoints) dim pointydis(ropes,maxpoints) dim pointweight#(ropes,maxpoints) dim pointconrope(ropes,maxpoints,maxconnections) dim pointconpoint(ropes,maxpoints,maxconnections) dim pointconxdis(ropes,maxpoints,maxconnections) dim pointconydis(ropes,maxpoints,maxconnections) maxbubbles=50 dim bubblex(maxbubbles) dim bubbley(maxbubbles) tightness#=0.3 ropepoints(1)=4 : rem Main Body pointx#(1,1)=170 pointy#(1,1)=200 pointxdis(1,2)=40 pointydis(1,2)=0 pointx#(1,2)=200 pointy#(1,2)=200 pointxdis(1,3)=40 pointydis(1,3)=0 pointx#(1,3)=250 pointy#(1,3)=200 pointxdis(1,4)=0 pointydis(1,4)=-10 pointx#(1,4)=270 pointy#(1,4)=200 ropepoints(2)=2 : rem Right Leg pointx#(2,1)=55 pointy#(2,1)=160 pointxdis(2,2)=55 pointydis(2,2)=10 pointx#(2,2)=110 pointy#(2,2)=190 JoinPoints(2,2,1,1,60,30,maxconnections) ropepoints(3)=2 : rem Left Leg pointx#(3,1)=55 pointy#(3,1)=230 pointxdis(3,2)=55 pointydis(3,2)=-10 pointx#(3,2)=110 pointy#(3,2)=210 JoinPoints(3,2,1,1,60,-30,maxconnections) ropepoints(4)=2 : rem Right Arm pointx#(4,1)=200 pointy#(4,1)=190 pointxdis(4,2)=45 pointydis(4,2)=0 pointx#(4,2)=155 pointy#(4,2)=190 JoinPoints(4,2,1,3,50,10,maxconnections) ropepoints(5)=2 : rem Left Arm pointx#(5,1)=300 pointy#(5,1)=210 pointxdis(5,2)=-45 pointydis(5,2)=0 pointx#(5,2)=345 pointy#(5,2)=210 JoinPoints(5,2,1,3,-50,-10,maxconnections) waterlevel#=240 watercycle#=0 bubblecount=0 bubbleon=1 do cls if mouseclick()=1 or mouseclick()=2 mx=mousex() my=mousey() for j=1 to ropes for i=1 to ropepoints(j) if mx>pointx#(j,i)-5 and my>pointy#(j,i)-5 and mx<pointx#(j,i)+5 and my<pointy#(j,i)+11 if mouseclick()=1 and pointweight#(j,i)<4 pointweight#(j,i)=pointweight#(j,i)+0.1 else if pointweight#(j,i)>0 pointweight#(j,i)=pointweight#(j,i)-0.1 endif endif endif next i next j mouseclick=1 else mouseclick=0 endif watercycle#=watercycle#+1 waterlevel#=240+sin(watercycle#)*10 for j=1 to ropes for i=1 to ropepoints(j) if i>1 xdiff#=pointx#(j,i)-pointx#(j,i-1) ydiff#=pointy#(j,i)-pointy#(j,i-1) if int(xdiff#)<>pointxdis(j,i) pointxvel#(j,i)=pointxvel#(j,i)+((pointxdis(j,i)-xdiff#)/tightness#)/100 endif if int(ydiff#)<>pointydis(j,i) pointyvel#(j,i)=pointyvel#(j,i)+((pointydis(j,i)-ydiff#)/tightness#)/100 endif endif if i<ropepoints(j) xdiff#=pointx#(j,i)-pointx#(j,i+1) ydiff#=pointy#(j,i)-pointy#(j,i+1) if int(xdiff#)<>pointxdis(j,i) pointxvel#(j,i)=pointxvel#(j,i)+((0-(pointxdis(j,i+1))-xdiff#)/tightness#)/100 endif if int(ydiff#)<>pointydis(j,i) pointyvel#(j,i)=pointyvel#(j,i)+((0-(pointydis(j,i+1))-ydiff#)/tightness#)/100 endif endif for k=1 to maxconnections if pointconrope(j,i,k)>0 trope=pointconrope(j,i,k) tpoint=pointconpoint(j,i,k) xdiff#=pointx#(j,i)-pointx#(trope,tpoint) ydiff#=pointy#(j,i)-pointy#(trope,tpoint) if int(xdiff#)<>pointconxdis(j,i,k) pointxvel#(j,i)=pointxvel#(j,i)+((pointconxdis(j,i,k)-xdiff#)/tightness#)/100 endif if int(ydiff#)<>pointconydis(j,i,k) pointyvel#(j,i)=pointyvel#(j,i)+((pointconydis(j,i,k)-ydiff#)/tightness#)/100 endif endif next k pointx#(j,i)=pointx#(j,i)+pointxvel#(j,i) pointy#(j,i)=pointy#(j,i)+pointyvel#(j,i) if pointx#(j,i)<1 then pointx#(j,i)=1 if pointx#(j,i)>639 then pointx#(j,i)=639 if pointy#(j,i)>468 then pointy#(j,i)=468 pointxvel#(j,i)=pointxvel#(j,i)*0.95 pointyvel#(j,i)=pointyvel#(j,i)*0.95 pointyvel#(j,i)=pointyvel#(j,i)+((waterlevel#+20)-pointy#(j,i))/100 if pointy#(j,i)<waterlevel# then pointyvel#(j,i)=pointyvel#(j,i)+0.1 pointyvel#(j,i)=pointyvel#(j,i)+pointweight#(j,i) next i next j if rnd(50)=0 and bubblecount=0 bubblecount=rnd(3)+5 endif if bubblecount>0 bubblecount=bubblecount-1 bubblex(bubbleon)=pointx#(1,4) bubbley(bubbleon)=pointy#(1,4) bubbleon=bubbleon+1 if bubbleon>maxbubbles then bubbleon=1 endif for i=1 to maxbubbles if bubbley(i)>0 bubbley(i)=bubbley(i)-1 bubblex(i)=bubblex(i)+(rnd(6)-3) if bubbley(i)<waterlevel#+2 then bubbley(i)=0 endif next i ink 255,0 box 1,waterlevel#,639,479 for j=1 to ropes for i=1 to ropepoints(j) ink rgb(220,220,35),0 if i<ropepoints(j) and (j=1 and i=3)=0 then line pointx#(j,i),pointy#(j,i),pointx#(j,i+1),pointy#(j,i+1) for k=1 to maxconnections if pointconrope(j,i,k)>0 trope=pointconrope(j,i,k) tpoint=pointconpoint(j,i,k) line pointx#(j,i),pointy#(j,i),pointx#(trope,tpoint),pointy#(trope,tpoint) endif next k if mouseclick=1 then circle pointx#(j,i),pointy#(j,i),4 if pointweight#(j,i)>0 line pointx#(j,i),pointy#(j,i),pointx#(j,i)-5,pointy#(j,i)+11 line pointx#(j,i),pointy#(j,i),pointx#(j,i)+5,pointy#(j,i)+11 line pointx#(j,i)-5,pointy#(j,i)+11,pointx#(j,i)+5,pointy#(j,i)+11 ink rgb(75,75,75),0 box pointx#(j,i)-4,pointy#(j,i)+10-pointweight#(j,i),pointx#(j,i)+4,pointy#(j,i)+10 endif next i next j ink rgb(220,220,35),0 circle pointx#(1,4),pointy#(1,4),20 ink rgb(255,255,255),0 for i=1 to maxbubbles if bubbley(i)>0 circle bubblex(i),bubbley(i),2 endif next i sync loop end function JoinPoints(rope1,point1,rope2,point2,xdis,ydis,maxconnections) connection1=0 for i=1 to maxconnections if pointconrope(rope1,point1,i)=0 then connection1=i : exit next i connection2=0 for i=1 to maxconnections if pointconrope(rope2,point2,i)=0 then connection2=i : exit next i if connection1<>0 and connection2<>0 pointconrope(rope1,point1,connection1)=rope2 pointconpoint(rope1,point1,connection1)=point2 pointconrope(rope2,point2,connection2)=rope1 pointconpoint(rope2,point2,connection2)=point1 pointconxdis(rope1,point1,connection1)=0-xdis pointconydis(rope1,point1,connection1)=0-ydis pointconxdis(rope2,point2,connection2)=xdis pointconydis(rope2,point2,connection2)=ydis endif endfunction