local m_global = require 'Global'
--Boot Module
Boot = {};
--Seed Randomizer
math.randomseed(os.time());
--Private Variables
local currentAlpha = 0;
local fadeOut = false;
local fadeIn = true;
local delay = false;
local delayTimer = timer.new();
local currentTime = 0;
local maxShowTime = 1000;
local randomColour = math.random(0, 100);
function Boot.Update()
--Should the Logo be fading in or out?
if fadeIn then
currentAlpha = currentAlpha + 1;
elseif fadeOut then
currentAlpha = currentAlpha - 1;
end
--Has the Current Alpha value reached the max, 255?
if (currentAlpha >= 255) and not delay then
--Start Delay Timer
fadeIn = false;
delayTimer:start();
delay = true;
elseif (currentAlpha < 0) and not delay then
--Proceed onto next state
return m_global.MENU;
end
if delay then
currentTime = delayTimer:time();
if currentTime > maxShowTime then
delayTimer:reset(0);
delay = false;
fadeOut = true;
end
end
return m_global.UNCHANGED;
end
function Boot.Draw()
--Clear Black
screen.clear(m_global.black);
--Draw Logo
image.blend(m_global.logo, 113, 79, currentAlpha);
--Draw Text
if (randomColour >= 50) then
screen.print(m_global.gameFont, 0, 252, "Misc. Artwork by John Riselvato aka Chi Kitory", 0.3,
color.new(255, 0, 0, currentAlpha), color.new(0, 0, 255, currentAlpha));
screen.print( m_global.gameFont, 0, 262, "Programming by Daniel Randell aka dan369", 0.3,
color.new(255, 0, 0, currentAlpha), color.new(0, 0, 255, currentAlpha));
elseif (randomColour < 50) then
screen.print(m_global.gameFont, 0, 252, "Misc. Artwork by John Riselvato aka Chi Kitory", 0.3,
color.new(0, 255, 0, currentAlpha), color.new(255, 255, 255, currentAlpha));
screen.print(m_global.gameFont, 0, 262, "Programming by Daniel Randell aka dan369", 0.3,
color.new(0, 255, 0, currentAlpha), color.new(255, 255, 255, currentAlpha));
end
end
return Boot;