1function intro_load()
2	gamestate = "intro"
3
4	introduration = 2.5
5	blackafterintro = 0.3
6	introfadetime = 0.5
7	introprogress = -0.2
8
9	screenwidth = 400*scale
10	screenheight = 224*scale
11	allowskip = false
12end
13
14function intro_update(dt)
15	allowskip = true
16	if introprogress < introduration+blackafterintro then
17		introprogress = introprogress + dt
18		if introprogress > introduration+blackafterintro then
19			introprogress = introduration+blackafterintro
20		end
21
22		if introprogress > 0.5 and playedwilhelm == nil then
23			playsound(stabsound)
24
25			playedwilhelm = true
26		end
27
28		if introprogress == introduration + blackafterintro then
29			menu_load()
30		end
31	end
32end
33
34function intro_draw()
35	local scale = scale
36	if scale <= 1 then
37		scale = 0.5
38	else
39		scale = 1
40	end
41	if introprogress >= 0 and introprogress < introduration then
42		local a = 255
43		if introprogress < introfadetime then
44			a = introprogress/introfadetime * 255
45		elseif introprogress >= introduration-introfadetime then
46			a = (1-(introprogress-(introduration-introfadetime))/introfadetime) * 255
47		end
48
49		love.graphics.setColor(255, 255, 255, a)
50
51		if introprogress > introfadetime+0.3 and introprogress < introduration - introfadetime then
52			local y = (introprogress-0.2-introfadetime) / (introduration-2*introfadetime) * 206 * 5
53			love.graphics.draw(logo, screenwidth/2, screenheight/2, 0, scale, scale, 142, 150)
54			love.graphics.setScissor(0, screenheight/2+150*scale - y, screenwidth, y)
55			love.graphics.draw(logoblood, screenwidth/2, screenheight/2, 0, scale, scale, 142, 150)
56			love.graphics.setScissor()
57		elseif introprogress >= introduration - introfadetime then
58			love.graphics.draw(logoblood, screenwidth/2, screenheight/2, 0, scale, scale, 142, 150)
59		else
60			love.graphics.draw(logo, screenwidth/2, screenheight/2, 0, scale, scale, 142, 150)
61		end
62	end
63end
64
65function intro_mousepressed()
66	if not allowskip then
67		return
68	end
69	stabsound:stop()
70	menu_load()
71end
72
73function intro_keypressed()
74	if not allowskip then
75		return
76	end
77	stabsound:stop()
78	menu_load()
79end