35 lines
758 B
Lua
35 lines
758 B
Lua
function _init()
|
|
init_movement()
|
|
init_mapgen()
|
|
generate_map({0, 0})
|
|
debug = true
|
|
end
|
|
|
|
|
|
function _update()
|
|
handle_input()
|
|
if (btn(5) and btn(4) and btnp(3)) debug = not debug
|
|
end
|
|
|
|
function _draw()
|
|
rectfill(0, 0, 127, 127, 0)
|
|
-- the screen is 128x128 pixels, so we can only draw 16x16 sprites
|
|
map(camera_pos[1], camera_pos[2], 0, 0, 16, 16)
|
|
draw_player()
|
|
if debug then
|
|
render_debug_info()
|
|
end
|
|
end
|
|
|
|
function render_debug_info()
|
|
clip(0, 0, 32, 32)
|
|
rectfill(0, 0, 32, 32, 0)
|
|
print(stat(0), 0, 0, 15)
|
|
print(camera_pos[1], 0, 8, 15)
|
|
print(camera_pos[2], 16, 8, 15)
|
|
print(facing[1], 0, 16, 15)
|
|
print(facing[2], 16, 16, 15)
|
|
print(fget(mget(camera_pos[1]+8, camera_pos[2]+8)), 0, 24, 15)
|
|
clip()
|
|
end
|