diff --git a/res/tower_howitzer_icon.png b/res/tower_howitzer_icon.png new file mode 100644 index 0000000..3e914a3 Binary files /dev/null and b/res/tower_howitzer_icon.png differ diff --git a/src/game.lua b/src/game.lua index 4d02ee5..40c6981 100644 --- a/src/game.lua +++ b/src/game.lua @@ -17,7 +17,8 @@ local TRDTS = { local function get_initial_game_state(seed) local STARTING_MONEY = 50 - local map, world = random_map(seed) + local map = random_map(seed) + local world = make_hex_grid_scene(map) return { map = map, -- map of hex coords map[x][y] to a 'tile' @@ -104,7 +105,6 @@ local function game_pause() end local function game_deserialize(json_string) - -- @TODO decode from some compressed format or whatever local new_state = am.parse_json(json_string) if new_state.version ~= version then @@ -112,7 +112,8 @@ local function game_deserialize(json_string) return nil end - new_state.map, new_state.world = random_map(new_state.seed) + new_state.map = random_map(new_state.seed) + new_state.world = make_hex_grid_scene(new_state.map) new_state.seed = nil for i,t in pairs(new_state.towers) do @@ -190,7 +191,6 @@ local function game_serialize() end end - -- @TODO b64 encode or otherwise scramble/compress return am.to_json(serialized) end @@ -640,7 +640,6 @@ function update_money(diff) state.money = state.money + diff end function game_end() state = {} game = false - -- @TODO anything end function game_save() diff --git a/src/grid.lua b/src/grid.lua index 3fc93f6..f884bb5 100644 --- a/src/grid.lua +++ b/src/grid.lua @@ -172,8 +172,8 @@ function map_elevation_color(elevation) else -- @TODO probably fix... this only happens when loading a save, and the tile has an elevation that's - -- higher that anything here - return vec4(0.1) + -- higher that anything here. it isn't really of any consequence though + return vec4(0) end end @@ -258,6 +258,6 @@ function random_map(seed) end end - return map, make_hex_grid_scene(map) + return map end diff --git a/src/mob.lua b/src/mob.lua index bf2bbaf..46fdc18 100644 --- a/src/mob.lua +++ b/src/mob.lua @@ -7,7 +7,7 @@ MOB_TYPE = { MAX_MOB_SIZE = hex_height(HEX_SIZE, HEX_ORIENTATION.FLAT) / 2 MOB_SIZE = MAX_MOB_SIZE -MOB_SPECS = { +local MOB_SPECS = { [MOB_TYPE.BEEPER] = { health = 30, speed = 8, @@ -33,9 +33,7 @@ local function grow_mob_health(mob_type, spec_health, time) return spec_health + math.pow(state.current_wave - 1, 2) end local function grow_mob_speed(mob_type, spec_speed, time) - -- @TODO maybe speed shouldn't grow with time at all. - -- if it does, a small amount with a horizontal asymptote - return spec_speed + return spec_speed + math.log(state.current_wave + 1) end local function grow_mob_bounty(mob_type, spec_bounty, time) return spec_bounty + math.pow(state.current_wave - 1, 2) diff --git a/src/tower.lua b/src/tower.lua index c4bb802..59753f6 100644 --- a/src/tower.lua +++ b/src/tower.lua @@ -12,7 +12,7 @@ TOWER_TYPE = { LIGHTHOUSE = 6 } -TOWER_SPECS = { +local TOWER_SPECS = { [TOWER_TYPE.WALL] = { name = "Wall", placement_rules_text = "Place on Ground", @@ -31,7 +31,7 @@ TOWER_SPECS = { short_description = "Fires area of effect artillery.", texture = TEXTURES.TOWER_HOWITZER, icon_texture = TEXTURES.TOWER_HOWITZER_ICON, - cost = 20, + cost = 30, range = 6, fire_rate = 4, size = 0, @@ -79,7 +79,7 @@ TOWER_SPECS = { short_description = "Attracts nearby mobs; temporarily redirects their path", texture = TEXTURES.TOWER_LIGHTHOUSE, icon_texture = TEXTURES.TOWER_LIGHTHOUSE_ICON, - cost = 20, + cost = 70, range = 7, fire_rate = 1, size = 0, diff --git a/texture.lua b/texture.lua index 730e7b7..44043fe 100644 --- a/texture.lua +++ b/texture.lua @@ -65,7 +65,7 @@ function pack_texture_into_sprite(texture, width, height, color) y1 = 0, y2 = height, height = height } - if color then sprite.color end + if color then sprite.color = color end return sprite end