-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
38 lines (30 loc) · 751 Bytes
/
main.lua
File metadata and controls
38 lines (30 loc) · 751 Bytes
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
Gamestate = require "hump.gamestate"
Camera = require "hump.camera"
Class = require "hump.class"
vector = require "hump.vector"
Player = require "player"
Block = require "block"
local game = {}
function game:enter()
self.cam = Camera(0, 0)
self.walls = {}
self.player = Player(vector(100, 100), self.walls)
table.insert(self.walls, Block(vector(200, 200), vector(32, 32)))
table.insert(self.walls, Block(vector(0, 0), vector(800, 600)))
end
function game:update(dt)
self.player:update(dt)
for i,block in ipairs(self.walls) do
block:update(dt)
end
end
function game:draw()
self.player:draw()
for i,block in ipairs(self.walls) do
block:draw(dt)
end
end
function love.load()
Gamestate.registerEvents()
Gamestate.switch(game)
end