local time1 = 0
local time2 = g_Time
local timepassed = time2 - time1
local imagenumber = 0

--change to however many different images you have
local max_images = 2
local delay = 0.05
--local lightning = 0
--local xpos = math.random(5,95)

function rain_init(e)
LoadImages("weather",0)
SetImagePosition(0,0)
SetImageAlignment(1)
--LoadImages("weather/lightning",4)
end

function rain_main(e)

if time1 == 0 then
time1 = g_Time
end
time2 = g_Time
timepassed = (time2 - time1) / 1000
if timepassed >= delay then
ShowImage(imagenumber)
if imagenumber < max_images - 1 then
imagenumber = imagenumber + 1
--if math.random(10) == 5 then 
--lightning = 0
--xpos = math.random(5,95)
--end
else
imagenumber = 0
end
time1 = 0
end

--[[
if g_PlayerAngX <= -21 then
if lightning < 5 then
SetImageAlignment(1)
lightning = lightning + 1
SetImagePosition(xpos,0)
ShowImage(math.random(4,6))
end
else
lightning = 0
xpos = math.random(5,95)
end
--Prompt(g_PlayerAngX)
--]]
end
