-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsceneGameOver.lua
More file actions
49 lines (42 loc) · 1.31 KB
/
sceneGameOver.lua
File metadata and controls
49 lines (42 loc) · 1.31 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
require("sceneManager")
local sceneMenu = newScene("GameOver")
local Image = love.graphics.newImage("images/gameover.png")
local Game = require("game")
local tank = require("tank")
sceneMenu.load = function(data)
local sound = love.audio.newSource("sons/gameover.wav", "static")
Game.Music:stop()
sound:stop()
sound:play()
end
sceneMenu.update = function(dt)
end
sceneMenu.draw = function()
love.graphics.draw(Image, 0, 0)
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", SCREEN_WIDTH / 2 - 100, SCREEN_HEIGHT - 110, 200, 100)
love.graphics.setColor(1, 1, 1)
local fontOld = love.graphics.getFont()
love.graphics.setFont(love.graphics.newFont(60))
local font = love.graphics.getFont()
local Size = font.Size
local textWidth = font:getWidth(tank.points)
local textHeight = font:getHeight()
love.graphics.print(
tank.points,
(SCREEN_WIDTH / 2 - 100) + 100 - (textWidth / 2),
(SCREEN_HEIGHT - 110 + 50) - textHeight / 2
)
love.graphics.setFont(fontOld)
end
sceneMenu.mousepressed = function(x, y, button)
changeScene("Menu", "")
end
sceneMenu.keypressed = function(key)
if key == "space" then
changeScene("Menu", "")
end
end
sceneMenu.gamepadpressed = function(joystick, button)
changeScene("Menu", "")
end