[go: up one dir, main page]

Menu

[r49]: / trunk / Build / boot.lua  Maximize  Restore  History

Download this file

72 lines (60 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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;