49 lines
784 B
Lua
49 lines
784 B
Lua
require("player")
|
|
require("engine.vector")
|
|
require("engine.class")
|
|
require("engine.collision")
|
|
require("world")
|
|
|
|
function _config()
|
|
return {
|
|
name = "Game",
|
|
pixel_perfect = true,
|
|
game_id = "com.harper.usagitest",
|
|
}
|
|
end
|
|
|
|
collision.add(Player.aabb)
|
|
|
|
for i = 1, 10 do
|
|
local new_block = {
|
|
color = gfx.COLOR_DARK_GRAY,
|
|
aabb = {
|
|
x = (i - 1) * 10,
|
|
y = 50,
|
|
w = world.cell_size,
|
|
h = world.cell_size,
|
|
},
|
|
}
|
|
|
|
world.utils.set_tile(new_block.aabb.x, new_block.aabb.y, new_block)
|
|
end
|
|
|
|
world.utils.update_colliders()
|
|
|
|
function _init()
|
|
State = {}
|
|
end
|
|
|
|
function _update(dt)
|
|
Player:update(dt)
|
|
end
|
|
|
|
function _draw()
|
|
gfx.clear(gfx.COLOR_BLACK)
|
|
Player:draw()
|
|
for _, v in pairs(world.tiles) do
|
|
gfx.rect_fill(v.aabb.x, v.aabb.y, 10, 10, v.color)
|
|
end
|
|
collision.draw()
|
|
end
|