Fix collision detection.
This commit is contained in:
parent
98707059b6
commit
3985c3e301
3 changed files with 3 additions and 3 deletions
34
main.lua
Normal file
34
main.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue