/
main.lua
92 lines (64 loc) · 1.54 KB
/
main.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
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
84
85
86
87
88
89
90
91
92
--FTR main.lua
--Libraries
gamestate = require "libs/gamestate" --Hump.Gamestate
class = require "libs/class" --Hump.Class
require "libs/sick" --SICK(Highscores)
--Requires
require "lua/game"
require "lua/highscores"
require "lua/mainMenu"
require "lua/entitys/player"
require "lua/entitys/wallSpawner"
require "lua/utils"
require "lua/gameover"
require "lua/intro"
require "lua/credits"
--Shortcuts
lg = love.graphics
lkid = love.keyboard.isDown
lf = love.filesystem
--Randomseed
math.randomseed(os.time())
--Bildschirm
screenwidth = lg.getWidth()
screenheight = lg.getHeight()
function love.load()
--Version
version = "1.0"
--Debug
debugMode = false
--Default Image Filter
lg.setDefaultImageFilter("nearest", "nearest")
--Background-Farbe
love.graphics.setBackgroundColor(160, 250, 150)
--Erster Gamestate
gamestate.switch(credits)
gamestate.init()
--Standartfont laden
tinyFont = lg.newFont("font/pixel.ttf", 8)
smallFont = lg.newFont("font/pixel.ttf", 16)
normalFont = lg.newFont("font/pixel.ttf", 24)
countdownFont = lg.newFont("font/pixel.ttf", 48)
scoreFont = lg.newFont("font/pixel.ttf", 96)
lg.setFont(normalFont)
--SICK
highscore.set("highscores.txt", 10, "-", 0)
end
function love.update(dt)
--Gamestate-Lib
gamestate.update(dt)
end
function love.draw()
--Gamestate-Lib
gamestate.draw()
end
function love.keypressed(key)
--Gamestate-Lib
gamestate.keypressed(key)
end
function love.quit()
highscore.save()
end
function love.quit()
game:focus(f)
end