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:
Anna Rose Wiggins 2019-12-11 01:06:33 -05:00
parent 2ca23a7b4e
commit 16bcbc8e00
4 changed files with 98 additions and 111 deletions

View file

@ -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.