-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
83 lines (68 loc) · 1.73 KB
/
main.lua
File metadata and controls
83 lines (68 loc) · 1.73 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
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
local player = require("player/player")
local attack = require("player/attack")
local target = require("target/target")
local start_menu = require("menus/start_menu")
local pause_menu = require("menus/pause_menu")
function love.load()
love.window.setMode(
love.graphics.getWidth(),
love.graphics.getHeight(),
{
fullscreen = true,
display = 2,
resizable = false
}
)
love.window.setTitle("on choisira plus tard.")
love.graphics.setBackgroundColor(0.2, 0.2, 0.2)
-- Player --
player.load()
------------
-- Target --
target.load()
------------
start_menu.loadStartMenu()
pause_menu.loadPauseMenu()
end
function love.keypressed(key)
if key == "escape" then
pause_menu.toggle()
return -- on sort pour ne pas passer la touche à target
end
if not pause_menu.isPaused then
target.keypressed(key)
end
end
function love.update(dt)
if start_menu.isMenu == false then
if pause_menu.isPaused then
return
end
-- Player --
player.update(dt)
attack.update(dt)
------------
target.update(dt)
end
end
function love.draw()
love.graphics.setColor(1, 1, 1)
--------- Player ----------
if player.hp <= 0 then
player.gameOver()
else
if start_menu.isMenu == true then
start_menu.drawStartMenu()
else
player.draw()
attack.draw()
----------------------------
---------- Target ----------
target.draw()
----------------------------
---------- Map -------------
----------------------------
end
end
pause_menu.drawPauseMenu()
end