1. Lightning sorta screen saver
- Posted by Robert B Pilkington <bpilkington at JUNO.COM> Jun 27, 1998
- 479 views
- Last edited Jun 28, 1998
Here's a little DOS screen saver inspired by the storm season... :) Any ideas on how to do the draw_line() function in Win32? (For an actual Windows 95/98/NT screen saver.) Any comments or suggestions appreciated. (Especially on how to make the lightning look better... It looks great for only about an hours work.) I'll work on this some more later, but it's nice to show off a neat demo. :) (And get some ideas in the process :) -- Start (TESTED! ;) code ----------------------------------------------------------------------------- -- Name ----> Lightning Screensaver --- DOS Lightning screensaver -- -- Filename > LIGHT.EX --- -- -- Author --> Robert B Pilkington --- Pretty cool for an hours work -- -- Version -> 0.30.00 --- -- -- Date ----> 06/27/1998 --- -- ----------------------------------------------------------------------------- -- I N C L U D E S ---------------------------------------------------------- include graphics.e include image.e -- G L O B A L S ------------------------------------------------------------ object junk sequence lightning lightning = {} -- S U B R O U T I N E S ---------------------------------------------------- procedure delay() -- Wait one clock tick atom oldtime oldtime = time() while oldtime = time() do -- nothing end while end procedure procedure Create_Lightning(integer x, integer y) -- Creates a burst of lightning sequence flash flash = {{x, y}} for i = 1 to rand(10)+20 do junk = rand({11, 10}) junk[1] = (junk[1] - 6)*5 + flash[length(flash)][1] junk[2] = (junk[2] - 3)*5 + flash[length(flash)][2] flash = append(flash, junk) end for lightning = append(lightning, flash) for i = 1 to length(flash) do if rand(length(flash))=1 then if length(lightning) < 20 then Create_Lightning(flash[i][1], flash[i][2]) end if end if end for end procedure procedure Draw_Lightning() -- Draws the lightning for i = 1 to length(lightning) do if i <= 6 then junk = get_all_palette() junk = junk[1] junk = palette(0, {junk[1]+5, junk[2]+5, junk[3]+10}) end if draw_line(11, lightning[i]) end for end procedure procedure Erase_Lightning() for i = 1 to length(lightning) do if i <= 6 then junk = get_all_palette() junk = junk[1] junk = palette(0, {junk[1]-5, junk[2]-5, junk[3]-10}) end if draw_line(0, lightning[i]) end for end procedure procedure Do_Lightning() Create_Lightning(rand(320), rand(100)) for i = 1 to 3 do Draw_Lightning() delay() Erase_Lightning() for j = 1 to rand(3) do delay() end for end for lightning = {} end procedure -- M A I N ------------------------------------------------------------------ procedure main() junk = graphics_mode(18) while get_key() = -1 do if rand(30) = 1 then Do_Lightning() end if delay() end while junk = graphics_mode(-1) end procedure main() -- End tested code _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]