-
Notifications
You must be signed in to change notification settings - Fork 8
/
winScreen.lua
49 lines (39 loc) · 948 Bytes
/
winScreen.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
winScreen = {}
--
function winScreen.init()
winScreen.done = false
-- Load image
winScreen.image = love.graphics.newImage("assets/WinScreen.png")
winScreen.image:setFilter("nearest","nearest")
-- Play music and loop it.
music = love.audio.newSource( "assets/Win.ogg" , "stream" )
music:setLooping(true)
love.audio.play(music)
local toasts = {
"Buuuuuuuuurrrrrrp!",
"Way to go Schmo",
"Gadzooks, its flat!",
"Virus Installed",
"Where's the pretzels?",
"Don't drink it all!"
}
math.randomseed(os.time())
local toastCount = #toasts
winScreen.toast = toasts[math.random(toastCount)]
end
--
function winScreen.update(dt)
-- nothing to do
end
--
function winScreen.draw()
love.graphics.draw(winScreen.image, 0, 0, 0, 2, 2, 0, 0, 0, 0)
love.graphics.setColor(0, 0, 0, 128)
love.graphics.print(winScreen.toast, 20, 20)
end
--
function winScreen.keypressed(key)
-- Done
winScreen.done = true
love.audio.stop()
end