diff --git a/main.lua b/main.lua index e948713..a53d5a5 100644 --- a/main.lua +++ b/main.lua @@ -44,7 +44,7 @@ require "src/tower" function main_action(self) - self"hex_backdrop""rotate".angle = math.wrapf(self"hex_backdrop""rotate".angle - 0.002 * am.delta_time, math.pi*2) + self"hex_backdrop""rotate".angle = math.wrapf(self"hex_backdrop""rotate".angle - 0.005 * am.delta_time, math.pi*2) end function make_main_scene_toolbelt() @@ -54,23 +54,19 @@ function make_main_scene_toolbelt() false, false, { - label = "new game", texture = TEXTURES.NEW_GAME_HEX, - action = function() end + action = function() game_init() end }, { - label = "load game", texture = TEXTURES.LOAD_GAME_HEX, action = function() game_init(am.load_state("save", "json")) end }, false, { - label = "settings", texture = TEXTURES.SETTINGS_HEX, action = function() end }, { - label = "about", texture = TEXTURES.ABOUT_HEX, action = function() end }, @@ -78,7 +74,6 @@ function make_main_scene_toolbelt() false, false, { - label = "map editor", texture = TEXTURES.MAP_EDITOR_HEX, action = function() log("map editor not implemented") end }, @@ -167,8 +162,6 @@ function main_scene() return group end -win.scene = am.group() win.scene = main_scene() ---game_init() noglobals() diff --git a/src/game.lua b/src/game.lua index 8c2a130..08de570 100644 --- a/src/game.lua +++ b/src/game.lua @@ -146,6 +146,11 @@ local function game_deserialize(json_string) if t then new_state.towers[i] = tower_deserialize(t) + for _,h in pairs(new_state.towers[i].hexes) do + local tile = hex_map_get(new_state.map, h.x, h.y) + tile.elevation = tile.elevation + new_state.towers[i].height + end + -- @STATEFUL, shouldn't be done here new_state.world:append(new_state.towers[i].node) end diff --git a/src/mob.lua b/src/mob.lua index 986cf5f..3aff201 100644 --- a/src/mob.lua +++ b/src/mob.lua @@ -100,7 +100,7 @@ function make_mob_node(mob_type, mob) if mob_type == MOB_TYPE.BEEPER then return am.group{ - am.rotate(state.time) + am.rotate(am.current_time()) -- state.time is not garunteed to be set when deserializing ^ pack_texture_into_sprite(TEXTURES.MOB_BEEPER, MOB_SIZE, MOB_SIZE), am.translate(0, -10) ^ healthbar diff --git a/src/tower.lua b/src/tower.lua index 4833c24..4b9783f 100644 --- a/src/tower.lua +++ b/src/tower.lua @@ -230,8 +230,8 @@ end function tower_deserialize(json_string) local tower = entity_basic_json_parse(json_string) - tower.hexes = {} for i,h in pairs(tower.hexes) do + log(h) tower.hexes[i] = vec2(tower.hexes[i][1], tower.hexes[i][2]) end