Large refactor to avoid the need to use map() and camera() - the new approach just re-calculates the local world and allows us to scroll 'smoothly' forever.
This commit is contained in:
parent
2ca23a7b4e
commit
16bcbc8e00
4 changed files with 98 additions and 111 deletions
21
main.lua
21
main.lua
|
@ -1,24 +1,23 @@
|
|||
function _init()
|
||||
init_data()
|
||||
init_sound()
|
||||
init_mapgen()
|
||||
init_sound""
|
||||
init_world""
|
||||
init_player(32, 32)
|
||||
generate_map(0, 0)
|
||||
init_debug()
|
||||
init_debug""
|
||||
end
|
||||
|
||||
|
||||
function _update()
|
||||
handle_input()
|
||||
handle_map_update()
|
||||
handle_input""
|
||||
-- handle_map_update""
|
||||
end
|
||||
|
||||
function _draw()
|
||||
cls()
|
||||
cls""
|
||||
-- the screen is 128x128 pixels, so it fits 16x16 sprites
|
||||
map(camera_pos_x, camera_pos_y, 0, 0, 16, 16)
|
||||
draw_player()
|
||||
debug_print()
|
||||
-- map(camera_pos_x, camera_pos_y, 0, 0, 16, 16)
|
||||
draw_world_segment(player_pos_x, player_pos_y)
|
||||
draw_player""
|
||||
debug_print""
|
||||
end
|
||||
|
||||
-- decide whether we need to regenerate the map.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue