This may be good for Horror games. Simple Thing that move and hides a light to simulate Lightning. Uses functions so is easy to integrate.
`Set Up Screen
`Set Screen Width and Height
load dll "user32.dll",1
SW=call dll(1,"GetSystemMetrics",0)
SH=call dll(1,"GetSystemMetrics",1)
delete dll 1
set display mode SW,SH,32
maximize window
sync on : sync rate 60
Set camera range 1,999999999
`Set Background to Black
Backdrop on
color backdrop RGB(0,0,0)
` Create Enviroment
`Create Floor
Make object box 1,500,0,500
Position Object 1,0,0,0
Color Object 1,RGB(103,84,84)
`Create Houses
FOR h=2 to 11
Make Object Box h,50,24,35
Position Object h,RND(500)-250,12,RND(500)-250
color object h,RGB(255,0,0)
NEXT
`Set Up Camera
Position Camera -200,75,0
Point Camera 0,0,0
`Set Up Lightning
Lightning_Setup()
`Store the time and the Time Flash as globals
Global Time as Integer
Time=Timer()
`the Timeflash# float is needed so that the light dissapears
Global TimeFlash as Integer
TimeFlash=Timer()
Do
Lightning(2000,100,25)
Sync
Loop
FUNCTION Lightning(IntervalMin,IntervalMax,FlashLength)
` Checks if it should show lighting - I use RND alot here to try and make it seem less mechanical
IF (timer()-Time)>IntervalMin+RND(IntervalMax-IntervalMin)
`Sets the new time value - Need this
Time=timer()
`Give the Lightning a random position
Position Light 1,RND(500)-250,75+RND(50),RND(500)-250
`Show the light to make it flash
Show Light 1
`Store this so that we know when the flash started
TimeFlash=timer()
ENDIF
`This Hide's the light when a defined amount of time has passed - Controlling the length of the flash
IF (timer()-TimeFlash)>FlashLength
Hide Light 1
ENDIF
ENDFUNCTION
FUNCTION Lightning_Setup()
`Create our Light to be our Lightning
Make Light 1
` The positioning below doesn't matter because we'll be giving it a position in the main loop
Set Point Light 1,0,0,0
Set Light Range 1,500
Hide Light 1
`Set The ambient light down and Hide the default light
Set Ambient Light 3
Hide Light 0
ENDFUNCTION