0 Members and 1 Guest are viewing this topic.
' - P-Helix V1.0 - Code by Xone (c)2k8' User ------------------------------- P = 50 rem Particles T = 15 rem Tail-L per Particle ew = 40 rem Emitter Width [1 to 320] es = 12 rem X Emit Speed g = 1.3 rem Grav a = 60 rem Air Fric rem Axis Repel/Attract Gx = 0.2 Gy = 1.3' ------------------------------------open window 640,512: X=320: Y=400: gosub st: Label Lpsetrgb 0,0,0,0:setdrawbuf CBu: CBu=1-CBu: setdispbuf CBuclear windowfor i = 1 to P u(i)=u(i)-0.002:F=u(i) v(i,1)=v(i,1)-v(i,1)/a:v(i,2)=v(i,2)-v(i,2)/a+g t(i,1)=t(i,1)+v(i,1):t(i,2)=t(i,2)+v(i,2) if t(i,1)<X v(i,1)=v(i,1)+(Gx*F) if t(i,1)>X v(i,1)=v(i,1)-(Gx*F) if t(i,2)<0 v(i,2)=v(i,2)+Gy*F if t(i,2)>0 v(i,2)=v(i,2)-Gy*F if t(i,2)>=Y+(F*2) then v(i,1)=v(i,1)/1.01:v(i,2)=-v(i,2)/1.3:u(i)=u(i)-0.01 fi if F<0.1 gosub sn: w(i)=w(i)+1: if w(i)>T w(i)=T if w(i)<T then:f(i,w(i),1)=t(i,1):f(i,w(i),2)=t(i,2) else for L=1 to w(i) if L<T then:f(i,L,1)=f(i,L+1,1):f(i,L,2)=f(i,L+1,2) else:f(i,L,1)=t(i,1):f(i,L,2)=t(i,2):fi next fi for S=1 to w(i): if u(i)>0.2 gosub fl:next setrgb 1, 0,200*((F-0.3)*10),130*((F-0.3)*2):ss=(u(i)*1.2) if F>0.4 fill rect t(i,1)-ss,t(i,2)-ss to t(i,1)+ss,t(i,2)+ssnextGoto Lplabel stfor p = 1 to P dim t(p,2):t(p,1)=X-ew+ran(ew*2):t(p,2)=Y dim o(p,2):o(p,1)=t(p,1):o(p,2)=t(p,2) dim v(p,2):v(p,1)=(-X+t(p,1))/(ew/es):v(p,2)=-p/6 dim u(p):u(p)=ran(1.1) for j=1 to T dim f(p,j,2):f(p,j,1)=t(p,1):f(p,j,2)=t(p,2) dim w(p):w(p)=0 nextnextreturnlabel fl Q=(w(i)+1)-S:H=300-((S+S)*100)/T:K=u(i)*130:setrgb 1,K,H/1.4,0 if f(i,Q,1)<>o(i,1) and f(i,Q,2)<>o(i,2) then if Q<w(i) line f(i,Q,1),f(i,Q,2) if Q=w(i) line f(i,Q,1),f(i,Q,2) to f(i,Q,1),f(i,Q,2) else if Q<w(i) line f(i,Q+1,1),f(i,Q+1,2) to f(i,Q,1),f(i,Q,2) line f(i,Q-1,1),f(i,Q-1,2) to f(i,Q-1,1),f(i,Q-1,2) fireturnlabel sn u(i)=1.1: t(i,1)=X-ew+ran(ew*2):t(i,2)=Y o(i,1)=t(i,1):o(i,2)=t(i,2) v(i,1)=(-X+t(i,1))/(ew/es):v(i,2)=-i/6 for W=1 to T f(i,W,1)=t(i,1):f(i,W,2)=t(i,2) nextreturn