-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsplash.lua
36 lines (31 loc) · 872 Bytes
/
splash.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
splash = {}
function splash.load()
splash.dt_temp = 0
end
function splash.draw()
love.graphics.draw(imgs["title"], 0, (splash.dt_temp-1) * 32 * scale, 0, scale, scale)
love.graphics.setColor(fontcolor.r, fontcolor.g, fontcolor.b)
-- Show after 2.5 seconds
if splash.dt_temp == 2.5 then
love.graphics.printf("Press Start", 0, 80 * scale, love.graphics.getWidth(), "center")
end
-- Reset the color
love.graphics.setColor(255, 255, 255)
-- If previous game
if game.score ~= 0 then
love.graphics.printf("Score:"..game.score,0,96*scale,160*scale,"center")
end
end
function splash.update(dt)
-- Update dt_temp
splash.dt_temp = splash.dt_temp + dt
-- Wait 2.5 seconds, then stop in place.
if splash.dt_temp > 2.5 then
splash.dt_temp = 2.5
end
end
function splash.keypressed(key)
-- Change to game state, and init game.
state = "game"
game.load()
end