-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
37 lines (33 loc) · 835 Bytes
/
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
local love = require("love")
-- Load other tables
local player = require("player")
local asteroids = require("asteroids")
local gameInterface = require("gameInterface")
local menuInterface = require("menuInterface")
local oldState
-- Main functions
function love.load()
player:load()
gameInterface:load()
GameState = "menu"
PreviousScore = -1
Font = love.graphics.newFont("font.ttf", 35)
end
function love.update(delta)
if GameState == "game" then
player.update(delta, asteroids)
asteroids.update(delta, player)
else
menuInterface.update(player, asteroids)
end
oldState = GameState
end
function love.draw()
if GameState == "game" then
player.draw()
asteroids.draw()
gameInterface.draw(player)
else
menuInterface.draw()
end
end