January 16, 2021, 06:32:48 AM

Author Topic: [bb] snow by jankupila [ 1+ years ago ]  (Read 413 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] snow by jankupila [ 1+ years ago ]
« on: June 29, 2017, 12:28:40 AM »
Title : snow
Author : jankupila
Posted : 1+ years ago

Description : snow

Code :
Code: BlitzBasic
  1. Graphics 800,600
  2.  
  3. Type THiutale
  4. Field x:Int
  5. Field y:Int
  6. End Type
  7.  
  8. Local hiutale_lukumaara:Int=12
  9.  
  10. Global lumilist:TList=CreateList()
  11.  
  12. While Not KeyDown(key_escape)
  13. For Local m=1 To hiutale_lukumaara
  14. Local Newhiutale:Thiutale
  15. Newhiutale=New THiutale
  16.  
  17. newhiutale.x=Rand(10,790)
  18. newhiutale.y=1
  19. ListAddLast(lumilist,newhiutale)
  20. Next
  21.  
  22. For Local hiutale:thiutale=EachIn lumilist
  23. hiutale.x:+Rand(-1,1)
  24. hiutale.y:+1
  25. Plot (hiutale.x,hiutale.y)
  26. If hiutale.y=500 Then lumilist.remove hiutale
  27. DrawLine 1,500,800,500
  28.  
  29. Next
  30. DrawText "Particles : "+lumilist.count(),20,20
  31.  
  32. Flip
  33. Cls
  34. 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
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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.
Code: [Select]
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]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal