Ooops
March 05, 2021, 07:38:42 AM

Author Topic: [bb] Simple Flakes by Adam_128 [ 1+ years ago ]  (Read 413 times)

Offline BlitzBot

[bb] Simple Flakes by Adam_128 [ 1+ years ago ]
« on: June 29, 2017, 12:28:40 AM »
Title : Simple Flakes
Author : Adam_128
Posted : 1+ years ago

Description : Snow flakes for your every day winter needs

Code :
Code: BlitzBasic
  1. ;Simple Flakes by Adam Kewley
  2. ;
  3. ;press esc to exit
  4.  
  5. Graphics 640,480,32,1
  6.  
  7. Type flakes
  8.  Field x#
  9.  Field y#
  10.  Field c
  11. End Type
  12.  
  13.  
  14. Global flake.flakes
  15. Const TOTALFLAKES=400
  16.  
  17. SetBuffer(BackBuffer())
  18.  
  19. InitFlakes()
  20.  
  21. While Not(KeyDown(1))
  22.  Cls
  23.  UpdateFlakes()
  24.  Flip
  25. Wend
  26.  
  27.  
  28. ;------------------------------------------------------------------------------------------------------------------------
  29.  
  30. Function InitFlakes()
  31.  
  32.   For x = 1 To TOTALFLAKES
  33.    flake.flakes = New flakes
  34.    flakex#=Rnd(640,-70)
  35.    flakey#=Rnd(480,0)
  36.    flakec=Rnd(4,0)
  37.   Next
  38.  
  39. End Function
  40.  
  41. Function UpdateFlakes()
  42.  
  43.   For flake.flakes = Each flakes
  44.  
  45.    If flakey#>480 Then
  46.     flakex#=Rnd(640,-70)
  47.     flakey#=0
  48.     flakec=Rnd(4,0)
  49.    End If
  50.  
  51.      Select flakec    
  52.       Case 1
  53.        Color 80,80,80
  54.        dir=Rnd(-.5,1)
  55.        flakex#=flakex#+dir+.1
  56.        flakey#=flakey#+.8
  57.        Oval flakex#,flakey#,1,1,1
  58.       Case 2
  59.        Color 120,120,120
  60.        dir=Rnd(-1,1.5)
  61.        flakex#=flakex#+dir+.1
  62.        flakey#=flakey#+1
  63.        Oval flakex#,flakey#,2,2,1
  64.       Case 3
  65.        Color 180,180,180
  66.        dir=Rnd(-1,2)
  67.        flakex#=flakex#+dir+.1
  68.        flakey#=flakey#+1.5
  69.        Oval flakex#,flakey#,3,3,1
  70.       Case 4
  71.        Color 250,250,250
  72.        dir=Rnd(-2,2.6)
  73.        flakex#=flakex#+dir+.1
  74.        flakey#=flakey#+2
  75.        Oval flakex#,flakey#,4.5,4.5,1
  76.      End Select  
  77.   Next
  78.  
  79. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal