Jump to content

Stupid screensaver help


stev379
 Share

Recommended Posts

Just for fun I'm trying to make a simple screensaver that looks like it's snowing (*). I've been able to get to point where the flakes fall at a slight different pace, but as you can see with the example code below, it ain't perfect. I can't get it to work in an array loop. I only posted enough that covers part of the left side of the screen, but it's only 1 row of flakes. I can work on getting more to fall later, but now I just want to know how to get this work in a loop rather than write the lables over and over.

If there are any suggestions on how to do this better, I'm open to ideas...

Snow_.03.05.au3

Link to comment
Share on other sites

a little better

HotKeySet("{ESC}", "Terminate")

Dim $Title = "Snow"

GUICreate($Title, @DesktopWidth, @DesktopHeight, 0, 0, 0x80000000)
GUISetBkColor(0)
GUISetFont(12, 400, "", "Terminal")
GUISetState()


Dim $w = 5
Dim $h = 0
Dim $Snow[18]
Dim $Flakes = 17
Dim $i
Dim $Pos
Dim $Speed = 20
Dim $n
Dim $r2


For $x = 1 To $Flakes
    
    $Snow[$x] = GUICtrlCreateLabel("*", 5, 4, 12, 15)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
Next

While 1
    $place = 5
    $r2 = 2
    $i = 0
    For $i = 0 To 17
        
        $n = Random(0, $r2, 1)
        
        
        Sleep($Speed)
        
        $Pos = ControlGetPos($Title, "", $Snow[$i])
        
        ControlMove($Title, "", $Snow[$i], $place, $Pos[1] + $n)
        
        $place = $place + 15
    Next
    
    
    If $h = @DesktopHeight Then $h = 0
    
    
WEnd



Func Terminate()
    Exit
EndFunc  ;==>Terminate

8)

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...