-
Notifications
You must be signed in to change notification settings - Fork 17
/
intro.lua
93 lines (79 loc) · 2.98 KB
/
intro.lua
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
function intro_load()
gamestate = "intro"
introduration = 2.5
blackafterintro = 0.3
introfadetime = 0.5
introprogress = 0
allowskip = false
end
function intro_update(dt)
allowskip = true
if introprogress < introduration+blackafterintro then
introprogress = introprogress + dt
if introprogress > introduration+blackafterintro then
introprogress = introduration+blackafterintro
end
if introprogress > 0.5 and playedwilhelm == nil then
playsound("stab")
playedwilhelm = true
end
if introprogress == introduration + blackafterintro then
menu_load()
shaders:set(1, shaderlist[currentshaderi1])
shaders:set(2, shaderlist[currentshaderi2])
end
end
end
function intro_draw()
local logoscale = scale
if logoscale <= 1 then
logoscale = 0.5
else
logoscale = 1
end
if introprogress >= 0 and introprogress < introduration then
local a = 1
if introprogress < introfadetime then
a = introprogress/introfadetime
elseif introprogress >= introduration-introfadetime then
a = (1-(introprogress-(introduration-introfadetime))/introfadetime)
end
love.graphics.setColor(1, 1, 1, a)
if introprogress > introfadetime+0.3 and introprogress < introduration - introfadetime then
local y = (introprogress-0.2-introfadetime) / (introduration-2*introfadetime) * 206 * 5
love.graphics.draw(logo, love.graphics.getWidth()/2, love.graphics.getHeight()/2, 0, logoscale, logoscale, 142, 150)
love.graphics.setScissor(0, love.graphics.getHeight()/2+150*logoscale - y, love.graphics.getWidth(), y)
love.graphics.draw(logoblood, love.graphics.getWidth()/2, love.graphics.getHeight()/2, 0, logoscale, logoscale, 142, 150)
love.graphics.setScissor()
elseif introprogress >= introduration - introfadetime then
love.graphics.draw(logoblood, love.graphics.getWidth()/2, love.graphics.getHeight()/2, 0, logoscale, logoscale, 142, 150)
else
love.graphics.draw(logo, love.graphics.getWidth()/2, love.graphics.getHeight()/2, 0, logoscale, logoscale, 142, 150)
end
local a2 = math.max(0, (1-(introprogress-.5)/0.3))
love.graphics.setColor(0.6, 0.6, 0.6, a2)
properprint("loading mari0 ce..", love.graphics.getWidth()/2-string.len("loading mari0 ce..")*4*scale, love.graphics.getHeight()/2-170*logoscale-7*scale)
love.graphics.setColor(0.2, 0.2, 0.2, a2)
properprint(loadingtext, love.graphics.getWidth()/2-string.len(loadingtext)*4*scale, love.graphics.getHeight()/2+165*logoscale)
end
end
function intro_mousepressed()
if not allowskip then
return
end
soundlist["stab"].source:stop()
soundlist["stab"].source:seek(0)
menu_load()
shaders:set(1, shaderlist[currentshaderi1])
shaders:set(2, shaderlist[currentshaderi2])
end
function intro_keypressed()
if not allowskip then
return
end
soundlist["stab"].source:stop()
soundlist["stab"].source:seek(0)
menu_load()
shaders:set(1, shaderlist[currentshaderi1])
shaders:set(2, shaderlist[currentshaderi2])
end