I was having a play inspired by Speed Thrasher, trying to make a realistic rope effect...
However... It wasn't very realistic... but it looks really cool!
There's no timing code so you might want to slow it down a bit, it runs fine on my pc at work, but my pc at work it rubbish!
Run this and move the mouse about!
However... It wasn't very realistic... but it looks really cool!
There's no timing code so you might want to slow it down a bit, it runs fine on my pc at work, but my pc at work it rubbish!
Run this and move the mouse about!
Graphics 640,480,0,2 ropeelements=50 ropelength#=100 Dim rope#(ropeelements,4) ; 1 = x ; 2 = y ; 3 = xspeed ; 4 = yspeed ropesection# = ropelength / ropeelements For n=1 To ropeelements rope(n,1)=MouseX() rope(n,2)=MouseY() Next SetBuffer BackBuffer() Repeat Cls x=MouseX() y=MouseY() For n=1 To ropeelements ; get location of previous point (mouse pointer if first point) If n=1 x1#=x-rope(n,1) y1#=y-rope(n,2) Else x1#=rope(n-1,1)-rope(n,1) y1#=rope(n-1,2)-rope(n,2) EndIf ; accelerate based on distance and direction of previous section dis# = Sqr((x1*x1)+(y1*y1)) rope(n,3) = rope(n,3) + (x1/2) rope(n,4) = rope(n,4) + (y1/2) ; Dampen rope(n,3) = rope(n,3) *.5 rope(n,4) = rope(n,4) *.5 ; Move the point rope(n,1)=rope(n,1) + rope(n,3) rope(n,2)=rope(n,2) + rope(n,4) If n>1 Then Line rope(n-1,1),rope(n-1,2),rope(n,1),rope(n,2) Next Flip Until KeyHit(1)