[bb] snow by jankupila [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:40

Previous topic - Next topic

BlitzBot

Title : snow
Author : jankupila
Posted : 1+ years ago

Description : snow

Code :
Code (blitzbasic) Select
Graphics 800,600

Type THiutale
Field x:Int
Field y:Int
End Type

Local hiutale_lukumaara:Int=12

Global lumilist:TList=CreateList()

While Not KeyDown(key_escape)
For Local m=1 To hiutale_lukumaara
Local Newhiutale:Thiutale
Newhiutale=New THiutale

newhiutale.x=Rand(10,790)
newhiutale.y=1
ListAddLast(lumilist,newhiutale)
Next

For Local hiutale:thiutale=EachIn lumilist
hiutale.x:+Rand(-1,1)
hiutale.y:+1
Plot (hiutale.x,hiutale.y)
If hiutale.y=500 Then lumilist.remove hiutale
DrawLine 1,500,800,500

Next
DrawText "Particles : "+lumilist.count(),20,20

Flip
Cls
Wend


Comments :


_PJ_(Posted 1+ years ago)

 This is bmax code again, I think :S


markcw(Posted 1+ years ago)

 Aye, and unindented *and* in a foreign bloody language too! What's the world coming to eh?


jankupila(Posted 1+ years ago)

 It IS bmax code, I added it to bmax category.


N(Posted 1+ years ago)

 No, this one's still under BB.  Now you've just got a duplicate.


plash(Posted 1+ years ago)

 Moderation needed.. (and a code-type change option)


Mr. Write Errors Man(Posted 1+ years ago)

 hiutale = snow flakehiutale_lukumaara = snow flake countlumilist = snow list


ShadowTurtle(Posted 1+ years ago)

 this is cool


starfox(Posted 1+ years ago)

 Here is the same code in B3D
Graphics 800,600
SetBuffer BackBuffer()

Type THiutale
Field x
Field y
End Type

Local hiutale_lukumaara=12
Local count=0

While Not KeyDown(1)
For m=1 To hiutale_lukumaara
Newhiutale.thiutale=New THiutale

newhiutalex=Rand(10,790)
newhiutaley=1
count = count + 1
Next

For hiutale.thiutale=Each thiutale
hiutalex=hiutalex+Rand(-1,1)
hiutaley=hiutaley+1
Plot (hiutalex,hiutaley)
If hiutaley=500 Then Delete hiutale:count=count-1
Line 1,500,800,500

Next
Text 20,20,"Particles : "+count

Flip
Cls
Wend
End



Guy Fawkes(Posted 1+ years ago)

 heres the same code in 2/1/2-D in b3d:with less lag:Graphics3D 800,600,0,2
SetBuffer BackBuffer()

Type THiutale
Field x
Field y
End Type

Local hiutale_lukumaara=12
Local count=0

While Not KeyDown(1)
For m=1 To hiutale_lukumaara
Newhiutale.thiutale=New THiutale

newhiutalex=Rand(10,790)
newhiutaley=1
count = count + 1
Next

For hiutale.thiutale=Each thiutale
If count < 1000
hiutalex=hiutalex+Rand(-1,1)
hiutaley=hiutaley+1
Plot (hiutalex,hiutaley)
If hiutaley=500 Then Delete hiutale:count=count-1
If count < 0 Then count = 0
If count > 1000 Then count = 0
If count > 1000 Then Delete hiutale: count=0
EndIf
Next
Text GraphicsWidth()/2,GraphicsHeight()/2,"Particles : "+count,1,1

UpdateWorld
RenderWorld

Flip
Cls
Wend
End



Sauer(Posted 1+ years ago)

 With the code above, once you get to 1000 particles it stops rendering and updating.  If you want to limit your particles to reduce slow down, use:For hiutale.thiutale=Each thiutale

hiutalex=hiutalex+Rand(-1,1)
hiutaley=hiutaley+1
Plot (hiutalex,hiutaley)
If hiutaley=500 Then Delete hiutale:count=count-1
If count < 0 Then count = 0
If count > 1000 Then Delete hiutale: count=count-1

Next
What happens now is that it keeps only 1000 particles onscreen at any time.  The catch is, once that 1000 is reached, it may only cover a portion of the screen depending on the amount of particles created per loop and the speed of their fall.  You would have to play with these values to get the look you want.


Blitzplotter(Posted 1+ years ago)

 IDEal makes it a cinch to modify the code to the following:- (using Edit/block commenting - a great menu function that other IDE's could benefit from), Protean was my IDE of choice - I've switched to IDEal.Added a couple of locals to help the snow fall reach the bottom of the GUI.Graphics3D 800,600,0,2
SetBuffer BackBuffer()

Type THiutale
Field x
Field y
End Type

let_snow_fall=1;  0 or 1
snow_drop=7;  set to 1 to  7

Local hiutale_lukumaara=12
Local count=0

While Not KeyDown(1)
For m=1 To hiutale_lukumaara
Newhiutale.thiutale=New THiutale

newhiutalex=Rand(10,790)
newhiutaley=1
count = count + 1
Next

For hiutale.thiutale=Each THiutale

hiutalex=hiutalex+Rand(-1,1)
hiutaley=hiutaley+1
Plot (hiutalex,hiutaley)
If hiutaley=500
If let_snow_fall=0 Then Delete hiutale:count=count-1
EndIf

If count < 0 Then count = 0
If count > (snow_drop*1000) Then Delete hiutale: count=count-1

Next


; For hiutale.thiutale=Each THiutale
; If count < 1000
; hiutalex=hiutalex+Rand(-1,1)
; hiutaley=hiutaley+1
; Plot (hiutalex,hiutaley)
; If hiutaley=500 Then Delete hiutale:count=count-1
; If count < 0 Then count = 0
; If count > 1000 Then count = 0
; If count > 1000 Then Delete hiutale: count=0
; EndIf
; Next
; Text GraphicsWidth()/2,GraphicsHeight()/2,"Particles : "+count,1,1

UpdateWorld
RenderWorld

Flip
Cls
Wend
End



Cold Storage(Posted 1+ years ago)

 Now if the snow piled up at the bottom... ;OP [/i]