@図形衝突反射01 --track0:Num,1,100,12,1 --track1:Vx,1,1000,160,1 --track2:Vy,1,1000,90,1 --track3:S※,0,100,20,1 --check0:Guid,1 --dialog:Figure/fig,fig="円";color/col,col=0xffffff;colorR/chk,chk1=1;SizeR※/chk,chk2=0;線幅,local fgs2=obj.track3;Seed,sd=100; -----------------------------------set1 local t0=math.floor(obj.track0) local t1=math.floor(obj.track1) local t2=math.floor(obj.track2) local t3=math.floor(obj.track3) local sw=obj.screen_w local sh=obj.screen_h local fr=obj.frame local tfr=obj.totalframe local ti=obj.time local tti=obj.totaltime -----------------------------------set2 list if(pxl==null)then pxl={} end if(pyl==null)then pyl={} end if(vxl==null)then vxl={} end if(vyl==null)then vyl={} end if(fgs1l==null)then fgs1l={} end -----------------------------------set3 param local num=t0 --初期化 if(fr==0)then sd=sd+num+t3 for i=1,num do --大きさ if(chk2==1)then fgs1l[i]=obj.rand(t3/4,t3,sd,i*3) else fgs1l[i]=t3 end --初期位置 pxl[i]=obj.rand(-sw/2+fgs1l[i]/2,sw/2-fgs1l[i]/2,sd,i*9) pyl[i]=obj.rand(-sh/2+fgs1l[i]/2,sh/2-fgs1l[i]/2,sd,i*18) --初速 vxl[i]=obj.rand(-t1*100,t1*100,sd,i*7)/10000 vyl[i]=obj.rand(-t2*100,t2*100,sd,i*14)/10000 end if(num < #pxl)then --不要配列削除 for i=num+1,#pxl do pxl[i]=null pyl[i]=null vxl[i]=null vyl[i]=null fgs1l[i]=null end end end -----------------------------------set program obj.setoption("drawtarget","tempbuffer",sw,sh) local temp="" for i=1,num do --基本挙動 if(chk1==1)then r=obj.rand(128,255,sd,i*16) g=obj.rand(128,255,sd,i*32) b=obj.rand(128,255,sd,i*48) col=RGB(r,g,b) end obj.load("figure",fig,col,fgs1l[i],fgs2) pxl[i]=pxl[i]+vxl[i] pyl[i]=pyl[i]+vyl[i] obj.setoption("blend","alpha_add") obj.draw(pxl[i],pyl[i]) if(obj.check0)then output=i obj.setfont("",fgs1l[i]/2) obj.load("text",output) obj.setoption("blend","alpha_sub") obj.draw(pxl[i],pyl[i]) end --壁面反射 if(pxl[i]>=sw/2-fgs1l[i]/2)then vxl[i]=-vxl[i] end if(pxl[i]<=-sw/2+fgs1l[i]/2)then vxl[i]=-vxl[i] end if(pyl[i]>=sh/2-fgs1l[i]/2)then vyl[i]=-vyl[i] end if(pyl[i]<=-sh/2+fgs1l[i]/2)then vyl[i]=-vyl[i] end --衝突反射 for j=1,num do if(i~=j)then r=(fgs1l[i]/2+fgs1l[j]/2)^2 dst=(pxl[i]-pxl[j])^2+(pyl[i]-pyl[j])^2 if(dst <= r)then vxl[i]=-vxl[i] vyl[i]=-vyl[i] end end end end obj.load("tempbuffer") @図形衝突反射02 --track0:Num,1,100,12,1 --track1:Vx,1,1000,160,1 --track2:Vy,1,1000,90,1 --track3:S,0,100,20,1 --check0:Guid,1 --dialog:Figure/fig,fig="円";color/col,col=0xffffff;線幅,local fgs2=obj.track3;colorR/chk,chk1=1;Seed,sd=100;効果時間,local et=2.00;効果名,local en="グロー";項目1,local ep1="強さ";値1,local ev1=40.0;項目2,local ep2="拡散";値2,local ev2=30.0;項目3,local ep3="しきい値";値3,local ev3=40.0;項目4,local ep4="ぼかし";値4,local ev4=1.0;図形拡散/chk,chk2=1; -----------------------------------set1 local t0=math.floor(obj.track0) local t1=math.floor(obj.track1) local t2=math.floor(obj.track2) local t3=math.floor(obj.track3) local sw=obj.screen_w local sh=obj.screen_h local fr=obj.frame local tfr=obj.totalframe local ti=obj.time local tti=obj.totaltime -----------------------------------set2 list if(pxl==null)then pxl={} end if(pyl==null)then pyl={} end if(vxl==null)then vxl={} end if(vyl==null)then vyl={} end if(tm1l==null)then tm1l={} end if(tm2l==null)then tm2l={} end if(flagl==null)then flagl={} end -----------------------------------set3 param local num=t0 local fgs=t3 local cmin=128 --初期化 if(fr==0)then sd=sd+num+fgs for i=1,num do --初期位置 pxl[i]=obj.rand(-sw/2+fgs/2,sw/2-fgs/2,sd,i*9) pyl[i]=obj.rand(-sh/2+fgs/2,sh/2-fgs/2,sd,i*18) --初速 vxl[i]=obj.rand(-t1*100,t1*100,sd,i*7)/10000 vyl[i]=obj.rand(-t2*100,t2*100,sd,i*14)/10000 --時間初期化 tm1l[i]=0 tm2l[i]=0 flagl[i]=false end --不要配列削除 if(num < #pxl)then for i=num+1,#pxl do pxl[i]=null pyl[i]=null vxl[i]=null vyl[i]=null tm1l[i]=null tm2l[i]=null flagl[i]=null end end end -----------------------------------set program obj.setoption("drawtarget","tempbuffer",sw,sh) local temp="" for i=1,num do --基本挙動 pxl[i]=pxl[i]+vxl[i] pyl[i]=pyl[i]+vyl[i] if(chk1==1)then r=obj.rand(cmin,255,sd,i*16) g=obj.rand(cmin,255,sd,i*32) b=obj.rand(cmin,255,sd,i*48) col=RGB(r,g,b) end obj.load("figure",fig,col,fgs,fgs2) obj.setoption("blend","alpha_add") --衝突効果1 tm2l[i]=obj.time if(flagl[i]==true and tm2l[i]-tm1l[i] <= et)then obj.effect(en,ep1,ev1,ep2,ev2,ep3,ev3,ep4,ev4) else flagl[i]=false end obj.draw(pxl[i],pyl[i]) --衝突効果2 if(chk2==1 and flagl[i]==true and tm2l[i]-tm1l[i] <= et)then t1=(tm2l[i]-tm1l[i])/et t2=1-t1 eidx=0 for k=0,359,30 do r=math.rad(k) cs=math.cos(r) sn=math.sin(r) dst=4*fgs*t1+fgs dx=pxl[i]+cs*dst dy=pyl[i]+sn*dst fgs0=fgs*t2 if(fgs0>=1)then if(chk1==1)then r=obj.rand(cmin,255,sd,i*16) g=obj.rand(cmin,255,sd,i*32) b=obj.rand(cmin,255,sd,i*48) col=RGB(r,g,b) end obj.load("figure",fig,col,fgs0,fgs2) obj.setoption("blend","alpha_add") if(eidx<=11)then obj.effect(en,ep1,ev1,ep2,ev2,ep3,ev3,ep4,ev4) end obj.draw(dx,dy) eidx=eidx+1 end end end if(obj.check0)then output=i obj.setfont("",fgs/2) obj.load("text",output) obj.setoption("blend","alpha_sub") obj.draw(pxl[i],pyl[i]) end --壁面反射 if(pxl[i]>=sw/2-fgs/2)then vxl[i]=-vxl[i] end if(pxl[i]<=-sw/2+fgs/2)then vxl[i]=-vxl[i] end if(pyl[i]>=sh/2-fgs/2)then vyl[i]=-vyl[i] end if(pyl[i]<=-sh/2+fgs/2)then vyl[i]=-vyl[i] end --衝突反射 for j=1,num do if(i~=j)then r=(fgs/2+fgs/2)^2 dst=(pxl[i]-pxl[j])^2+(pyl[i]-pyl[j])^2 if(dst <= r)then tm1l[i]=obj.time flagl[i]=true vxl[i]=-vxl[i] vyl[i]=-vyl[i] end end end end obj.load("tempbuffer") @図形衝突反射03 --track0:Num,1,100,12,1 --track1:Vx,1,1000,160,1 --track2:Vy,1,1000,90,1 --track3:S,0,100,20,1 --check0:Guid,1 --dialog:Figure/fig,fig="円";color/col,col=0xffffff;線幅,local fgs2=obj.track3;colorR/chk,chk1=1;Seed,sd=100;効果時間,local et=2.00;効果名,local en="グロー";項目1,local ep1="強さ";値1,local ev1=40.0;項目2,local ep2="拡散";値2,local ev2=30.0;項目3,local ep3="しきい値";値3,local ev3=40.0;項目4,local ep4="ぼかし";値4,local ev4=1.0;図形拡散/chk,chk2=1; -----------------------------------set1 local t0=math.floor(obj.track0) local t1=math.floor(obj.track1) local t2=math.floor(obj.track2) local t3=math.floor(obj.track3) local sw=obj.screen_w local sh=obj.screen_h local fr=obj.frame local tfr=obj.totalframe local ti=obj.time local tti=obj.totaltime -----------------------------------set2 list if(pxl==null)then pxl={} end if(pyl==null)then pyl={} end if(vxl==null)then vxl={} end if(vyl==null)then vyl={} end if(tm1l==null)then tm1l={} end if(tm2l==null)then tm2l={} end if(flagl==null)then flagl={} end -----------------------------------set3 param local num=t0 local fgs=t3 local cmin=128 --初期化 if(fr==0)then sd=sd+num+fgs for i=1,num do --初期位置 pxl[i]=obj.rand(-sw/2+fgs/2,sw/2-fgs/2,sd,i*9) pyl[i]=obj.rand(-sh/2+fgs/2,sh/2-fgs/2,sd,i*18) --初速 vxl[i]=obj.rand(-t1*100,t1*100,sd,i*7)/10000 vyl[i]=obj.rand(-t2*100,t2*100,sd,i*14)/10000 --時間初期化 tm1l[i]=0 tm2l[i]=0 flagl[i]=false end --不要配列削除 if(num < #pxl)then for i=num+1,#pxl do pxl[i]=null pyl[i]=null vxl[i]=null vyl[i]=null tm1l[i]=null tm2l[i]=null flagl[i]=null end end end -----------------------------------set program obj.setoption("drawtarget","tempbuffer",sw,sh) for i=1,num do --基本挙動 pxl[i]=pxl[i]+vxl[i] pyl[i]=pyl[i]+vyl[i] if(chk1==1)then r=obj.rand(cmin,255,sd,i*16) g=obj.rand(cmin,255,sd,i*32) b=obj.rand(cmin,255,sd,i*48) col=RGB(r,g,b) end obj.load("figure",fig,col,fgs,fgs2) obj.setoption("blend","alpha_add") --衝突効果1 tm2l[i]=obj.time if(flagl[i]==true and tm2l[i]-tm1l[i] <= et)then obj.effect(en,ep1,ev1,ep2,ev2,ep3,ev3,ep4,ev4) else flagl[i]=false end obj.draw(pxl[i],pyl[i]) --衝突効果2 if(chk2==1 and flagl[i]==true and tm2l[i]-tm1l[i] <= et)then t1=(tm2l[i]-tm1l[i])/et t2=1-t1 dx=pxl[i] dy=pyl[i] al=t2 fgs0=4*fgs*t1+fgs fgs00=fgs/10 if(fgs0>=1)then if(chk1==1)then r=obj.rand(cmin,255,sd,i*16) g=obj.rand(cmin,255,sd,i*32) b=obj.rand(cmin,255,sd,i*48) col=RGB(r,g,b) end obj.load("figure",fig,col,fgs0,fgs00) obj.setoption("blend","alpha_add") obj.effect(en,ep1,ev1,ep2,ev2,ep3,ev3,ep4,ev4) obj.draw(dx,dy,0,1,al) end end if(obj.check0)then output=i obj.setfont("",fgs/2) obj.load("text",output) obj.setoption("blend","alpha_sub") obj.draw(pxl[i],pyl[i]) end --壁面反射 if(pxl[i]>=sw/2-fgs/2)then vxl[i]=-vxl[i] end if(pxl[i]<=-sw/2+fgs/2)then vxl[i]=-vxl[i] end if(pyl[i]>=sh/2-fgs/2)then vyl[i]=-vyl[i] end if(pyl[i]<=-sh/2+fgs/2)then vyl[i]=-vyl[i] end --衝突反射 for j=1,num do if(i~=j)then r=(fgs/2+fgs/2)^2 dst=(pxl[i]-pxl[j])^2+(pyl[i]-pyl[j])^2 if(dst <= r)then tm1l[i]=obj.time flagl[i]=true vxl[i]=-vxl[i] vyl[i]=-vyl[i] end end end end obj.load("tempbuffer") --[[http://madeinpc.blog50.fc2.com/]]--