Add interactability with some map objects, and store changed map tiles in a buffer for persistence.

This commit is contained in:
Anna Rose Wiggins 2019-12-09 21:50:06 -05:00
parent 89a63f59b8
commit c6dd13d332
6 changed files with 120 additions and 92 deletions

View file

@ -87,8 +87,12 @@ function get_biome_name(pos_x, pos_y)
end
-- determine what sprite to render for a given position.
-- todo: this needs the ability to have a list of 'changed' tiles to check against.
-- pos_x and pos_y are global coordinates.
function get_tile(pos_x, pos_y)
-- lookup changes in the change buffer
local modded_sprite = mod_buffer[tostr(pos_x) .. "+" .. tostr(pos_y)]
if (modded_sprite) return modded_sprite
local biome_name = get_biome_name(pos_x, pos_y)
local biome = biome_data[biome_name]
local uid = generate_uid(pos_x, pos_y)