-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
61 lines (50 loc) · 1.1 KB
/
Copy pathmain.lua
File metadata and controls
61 lines (50 loc) · 1.1 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
SPR_SIZE = 16
Player = require("player")
Bullet = require("bullet")
Enemy = require("enemy")
Chip = require("chip")
Bomb = require("bomb")
Explosion = require("explosion")
Pixels = require("pixels")
Starfield = require("starfield")
Scene = require("scene")
Save = require("save")
Metadata = require("metadata")
Util = require("util")
function _config()
return {
name = "BOMBERFROG",
game_id = "com.brettmakesgames.bomberfrog",
icon = 1,
pixel_perfect = false,
}
end
function _init()
input.set_mouse_visible(false)
Save.load()
State = {
t = 0,
draw_debug = false,
}
Scene.switch_to(Scene.KEY.MAIN_MENU)
end
function _update(dt)
State.t += dt
assert(State.current_scene)
if State.pending_scene then
local current = Scene.current()
if current.close then
current.close()
end
State.current_scene = State.pending_scene
State.pending_scene = nil
local new_scene = Scene.current()
if new_scene.init then
new_scene.init(State)
end
end
Scene.current().update(dt, State)
end
function _draw(dt)
Scene.current().draw(dt, State)
end