I guess this would be a screensaver. As you guys can probably guess from some of the code that I've been sharing over the last few days, I've just been playing around at tossing different things at a program and seeing what sticks. I'm not really doing anything by goofing off, but I guess this would be similar to the Windows Mystify Screensaver, if anyone is interested in it.
It might need a few more lines to it to be a better replica, but it certainly seems to be on the right track to being something similar. Feel free to play with it and modify it as wanted for your own enjoyment.
Code: (Select All)
Screen _NewImage(800, 600, 32)
_FullScreen
Dim x1, y1, x2, y2 As Integer
Dim dx1, dy1, dx2, dy2 As Integer
Dim r, g, b As Integer
' Initialize coordinates and directions
x1 = Int(Rnd * 800): y1 = Int(Rnd * 600)
x2 = Int(Rnd * 800): y2 = Int(Rnd * 600)
dx1 = 5: dy1 = 8: dx2 = -5: dy2 = -8
Do
r = Int(Rnd * 256): g = Int(Rnd * 256): b = Int(Rnd * 256): a = Int(Rnd * 256)
Line (x1, y1)-(x2, y2), _RGBA32(r, g, b, a)
' Update coordinates
x1 = x1 + dx1: y1 = y1 + dy1: x2 = x2 + dx2: y2 = y2 + dy2
' Bounce off the edges of the screen
If x1 <= 0 Or x1 >= 800 Then dx1 = -dx1
If y1 <= 0 Or y1 >= 600 Then dy1 = -dy1
If x2 <= 0 Or x2 >= 800 Then dx2 = -dx2
If y2 <= 0 Or y2 >= 600 Then dy2 = -dy2
Line (0, 0)-(_Width, _Height), &H10000020&&, BF
_Display
_Limit 60
Loop Until InKey$ <> ""
System
It might need a few more lines to it to be a better replica, but it certainly seems to be on the right track to being something similar. Feel free to play with it and modify it as wanted for your own enjoyment.
