-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|490|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- Socoder -> Mini Challenges -> Make : Weather Effects Mon, 14 Sep 2009, 08:52 Jayenkai Create a simple world, 2D or 3D whatever you wish, then add weather effects. Make it as simple or as complex as you wish. -=-=- ''Load, Next List!'' Mon, 14 Sep 2009, 09:11 Jayenkai Blame HoboBen for this one ; Warning - lightning inside ; If you're epileptic, look away.. Graphics 800,600,32,2 SetBuffer BackBuffer() Dim rain(6) For n=1 To 6 rain(n)=CreateImage(512,512) SetBuffer ImageBuffer(rain(n)) Color 0,0,n*40 For m=1 To 80 x=Rand(0,511):y=Rand(0,511) For ox=-1 To 1 For oy=-1 To 1 Line x+(ox*512),y+(oy*512),x+1+(ox*512),y+3+(oy*512) Next Next Next Next SetBuffer BackBuffer() rainx#=0 rainy#=0 lightn=0 Repeat Cls ClsColor 0+lightn,0+lightn,20+lightn SeedRnd MilliSecs() If Rand(1,120)=1 Or KeyHit(2) Then lightn=150:lx=Rand(0,800) If lightn>0 Then lightn=lightn-(lightn/6) If lightn<20 Then lightn=0 rainy=rainy+4 rainx=rainx+2 For n=1 To 6 TileImage rain(n),rainx*(Float(n)*0.8),rainy*(Float(n)*0.8) Next SeedRnd (MilliSecs()/250) Color lightn,lightn,lightn For y=0 To lightn*3 Step 32 wx=lx:ax=wx wy=y:ay=wy For m=1 To 4 ax=ax+Rand(-lightn/4,lightn/4) ay=ay+Rand(-8,42) Line wx,wy,ax,ay wx=ax:wy=ay Next Next Flip Until KeyDown(1) --v -=-=- ''Load, Next List!'' Mon, 14 Sep 2009, 13:08 Phoenix This is lame compared to Jay's. Graphics(640, 480, 0, 2) SeedRnd(MilliSecs()) bg = CreateImage(640, 480) h# = 100 SetBuffer(ImageBuffer(bg)) LockBuffer() For i = 0 To 639 For j = 479-h To 479 WritePixelFast i, j, \$FFFFFFFF Next h = h + Rnd(-.5, .5) Next UnlockBuffer() For i = 0 To 640 Step 10 y = 480-130+Rand(80) Color 160+Rand(-30, 30), 100+Rand(-30, 30), 20+Rand(-30, 30) Rect i, y, Rand(10, 15), Rand(40, 50) Color 40, 200, 40 w = Rand(20, 60) h = Rand(20, 60) Oval i-w/2, y-h/2, w, h Color 220, 220, 220 For j = 0 To 100 Oval i+Rand(-w/2, w/2), y+Rand(-h/2, h/2), Rand(5), Rand(5) Next Next flakeImage = CreateImage(16, 16) SetBuffer(ImageBuffer(flakeImage)) Color 255, 255, 255 For i = 0 To 5 For j = 0 To 5 Line 8+Sin(360/5*j)*8, 8+Cos(360/5*j)*8, 8+Sin(360/5*j+180)*8, 8+Cos(360/5*j+180)*8 Next Next Type flake Field x#, y#, s#, w# End Type timer = CreateTimer(60) ClsColor 0, 0, \$DDDDDD SetBuffer(BackBuffer()) While(Not KeyHit(1)) WaitTimer(timer) DrawImage bg, 0, 0 For i = -50 To 640 If(Rand(0, 1000) = 0) f.flake = New flake f\x = i f\y = -16 f\s = Rnd(.5, 2) f\w = Rnd(1, 2) EndIf Next For f.flake = Each flake DrawImage flakeImage, f\x, f\y f\y = f\y + f\s f\x = f\x + Sin(f\y*f\w)*f\w If(f\y > 480) Then Delete f Next Flip Cls Wend End --v Mon, 14 Sep 2009, 13:38 Eikon Hail effect AppTitle "Hail" Graphics 640, 480, 16, 2 SeedRnd MilliSecs() Type Obj Field X#, Y#, ID, D# End Type Global wind# = 0, windD = Rand(0, 1) Global imgBack = CreateImage(640, 440) SetBuffer ImageBuffer(imgBack) tmpC1 = 0: tmpC2 = 0: tmpC3 = 0 For i = 0 To 440 Step 20 Color tmpC1, tmpC2, tmpC3 Rect 0, i, 640, 20, 1 tmpC1 = tmpC1 + 4: tmpC2 = tmpC2 + 4: tmpC3 = tmpC3 + 8 Next Global imgSqr = CreateImage(128, 128) SetBuffer ImageBuffer(imgSqr) Color 128, 255, 255 Rect 0, 0, 128, 128, 1 SetBuffer BackBuffer() While Not KeyDown(1) o.Obj = New Obj r# = Rnd(2, 6) o\X = Rand(-80, 720) o\Y = -(r) o\D = r DrawImage imgBack, 0, 0 Color 255, 255, 255 Rect 0, 440, 640, 40, 1 DrawImage imgSqr, 320 - 64, 440 - 128 For o.Obj = Each Obj tmpDel = 0 Oval o\X, o\Y, o\D, o\D, 1 o\X = o\X + wind# o\Y = o\Y + o\D * 1.5 If o\Y >= 440 Then tmpDel = 1 Else If ImageRectCollide(imgSqr, 320 - 64, 440 - 128, 0, o\X, o\Y, o\D, o\D) Then tmpDel = 1 SetBuffer ImageBuffer(imgSqr) Color 0, 0, 0 Oval o\X - (320 - 64), o\Y - (440 - 128), o\D * 2, o\D * 2 Color 255, 255, 255 SetBuffer BackBuffer() EndIf EndIf If tmpDel = 1 Then Delete o Next If windD = 0 Then If wind > -2 Then wind = wind - .01 Else windD = 1 Else If wind < 2 Then wind = wind + .01 Else windD = 0 EndIf If Rand(1, 20) = 10 Then If windD = 0 Then windD = 1 Else windD = 0 EndIf Text 1, 1, "Wind: " + Left\$(Str(wind), 4) Flip: Cls Wend: End --v Tue, 15 Sep 2009, 07:58 Jayenkai Gettin' in on the Snow action! SeedRnd MilliSecs() Graphics 800,600,32,2 SetBuffer BackBuffer() Type flake; as in snow.flake Field x,y End Type Type flake2; as in snow2.flake2 Field x,y End Type Global snowx#,snowy# Global snowtile=CreateImage(512,512) Global snowtile2=CreateImage(800,600) Global snowpile=CreateImage(800,600) For n=1 To 500 snow.flake=New flake snow\x=Rand(511):snow\y=Rand(511) Next For n=1 To 500 snow2.flake2=New flake2 snow2\x=Rand(799):snow2\y=Rand(599) Next Dim high#(800) For x=0 To 799:high(x)=595:Next wind#=0 windup#=0 Dim wwind(5) ClsColor 20,20,60 Repeat Cls addsnow( wwind(0) ) addsnow2( wind ) wind#=wind#+windup# If wind>3 Then wind=3:windup=-0.02 If wind<-3 Then wind=-3:windup=0.02 If Rand(5)=1 Then windup#=windup#+Rnd(-0.01,0.01) If windup#>0.15 Then windup#=0.15 If windup#<-0.15 Then windup#=-0.15 For n=0 To 4 wwind(n)=wwind(n+1) Next wwind(5)=wind DrawImage snowpile,0,0 Color 255,255,255:Rect 0,594,800,6,1 Flip False Until KeyDown(1) Function AddSnow(wind#) TileImage snowtile,snowx,snowy TileImage snowtile,snowx+Rand(-1,1),snowy+Rand(-1,1) snowy=snowy+0.4+Abs(wind#/4) snowx=snowx+wind SetBuffer ImageBuffer(snowtile) LockBuffer ImageBuffer(snowtile) d=0 For snow.flake=Each flake d=d+1 If Rand(0,4)=1 WritePixelFast(snow\x,snow\y,\$FF000000) If d<100 Then snow\x=snow\x+(Rand(-1,1)+(wind/8)) If d=>100 Then snow\x=snow\x+(Rand(-2,2)+(wind/4)) snow\y=snow\y+Rand(-1,1) If snow\x<0 Then snow\x=snow\x+512 If snow\y<0 Then snow\y=snow\y+512 If snow\x>511 Then snow\x=snow\x-512 If snow\y>511 Then snow\y=snow\y-512 WritePixelFast(snow\x,snow\y,\$FF222222+((d*0.3) Shl 16)+((d*0.3) Shl 8)+((d*0.3))) EndIf Next UnlockBuffer ImageBuffer(snowtile) SetBuffer BackBuffer() End Function Function AddSnow2(wind#) DrawImage snowtile2,0,0 DrawImage snowtile2,Rand(-1,1),Rand(-1,1) LockBuffer ImageBuffer(snowtile2) For snow2.flake2=Each flake2 WritePixelFast(snow2\x,snow2\y,\$FF000000,ImageBuffer(snowtile2)) snow2\x=snow2\x+(Rand(-2,2)+(wind*1.3)) snow2\y=snow2\y+Rand(0,2) If snow2\x<0 Then snow2\x=snow2\x+800 If snow2\y<0 Then snow2\y=snow2\y+600 If snow2\x>799 Then snow2\x=snow2\x-800 If snow2\y>599 Then snow2\y=snow2\y-600 If snow2\y>high(snow2\x) Addflake(snow2\x) snow2\y=0 EndIf WritePixelFast(snow2\x,snow2\y,\$FFFFFFFF,ImageBuffer(snowtile2)) Next UnlockBuffer ImageBuffer(snowtile2) End Function Function Addflake(x) SetBuffer ImageBuffer(snowpile) Color 255,255,255 For ex=-16 To 16 nx=(x+ex) If nx<0 Then nx=nx+800 If nx>799 Then nx=nx-800 high(nx)=high(nx)-((16-Abs(ex))*0.02) Line nx,high(nx),nx,600 Next SetBuffer BackBuffer() End Function --v -=-=- ''Load, Next List!''