-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.lua
87 lines (71 loc) · 2.22 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
require "lib.require"
require "src.values"
-- External libraries
GameState = require "lib.hump.gamestate"
Class = require "lib.hump.class"
Timer = require "lib.hump.timer"
json = require "lib.json"
-- Misc imports
Assets = require "src.assets"
Palette = require "src.palette"
utils = require.tree "src.utils"
--[[ Input ]] require "src.input.input"
-- Game imports
game = require "src.states.game"
Map = require "src.game.map"
World = require "src.game.world"
Facing = require "src.game.facing"
UnitData = require "src.game.unit.unitdata"
Unit = require "src.game.unit.unit"
parser = require "src.game.parser"
RuleParser = require "src.game.rules"
MoveManager = require "src.game.movement"
UpdateManager = require "src.game.updates"
ParticleSystem = require "src.game.particles"
main = {}
function love.load(args)
--Rules.parse = utils.performance.test(Rules.parse, "parse")
--utils.words.compare = utils.performance.test(utils.words.compare, "compare")
love.window.setTitle("bab be u - remasteredddd")
love.graphics.setDefaultFilter("nearest","nearest")
print("lily's the best <3")
print("no u <3")
Assets.load()
-- Assign Love2D events to the GameState system
GameState.registerEvents()
Input.registerEvents()
-- set up the input system
main.registerInputs()
GameState.switch(game)
end
function love.update(dt)
Timer.update(dt)
end
function love.keypressed(key)
Input.keyPressed(key)
end
function love.keyreleased(key)
Input.keyReleased(key)
end
function main.registerInputs()
Input.register("undo", Input.Button{
Input.Button.Key("z")
})
Input.register("reset", Input.Button{
Input.Button.Key("r")
})
Input.register("wait", Input.Button{
Input.Button.Key("space"),
Input.Button.Key("enter"),
Input.Button.Key("kp5")
})
Input.register("move (p1)", Input.Direction{
Input.Direction.Keys("d", nil, "s", nil, "a", nil, "w", nil)
})
Input.register("move (p2)", Input.Direction{
Input.Direction.Keys("right", nil, "down", nil, "left", nil, "up", nil)
})
Input.register("move (p3)", Input.Direction{
Input.Direction.Keys("kp6", "kp3", "kp2", "kp1", "kp4", "kp7", "kp8", "kp9")
})
end