Browse Source

update howitzer icon

master
Nicholas Hayashi 3 years ago
parent
commit
3b1943bcd3
  1. BIN
      res/tower_howitzer_icon.png
  2. 9
      src/game.lua
  3. 6
      src/grid.lua
  4. 6
      src/mob.lua
  5. 6
      src/tower.lua
  6. 2
      texture.lua

BIN
res/tower_howitzer_icon.png

After

Width: 600  |  Height: 450  |  Size: 85 KiB

9
src/game.lua

@ -17,7 +17,8 @@ local TRDTS = {
local function get_initial_game_state(seed) local function get_initial_game_state(seed)
local STARTING_MONEY = 50 local STARTING_MONEY = 50
local map, world = random_map(seed)
local map = random_map(seed)
local world = make_hex_grid_scene(map)
return { return {
map = map, -- map of hex coords map[x][y] to a 'tile' map = map, -- map of hex coords map[x][y] to a 'tile'
@ -104,7 +105,6 @@ local function game_pause()
end end
local function game_deserialize(json_string) local function game_deserialize(json_string)
-- @TODO decode from some compressed format or whatever
local new_state = am.parse_json(json_string) local new_state = am.parse_json(json_string)
if new_state.version ~= version then if new_state.version ~= version then
@ -112,7 +112,8 @@ local function game_deserialize(json_string)
return nil return nil
end 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 new_state.seed = nil
for i,t in pairs(new_state.towers) do for i,t in pairs(new_state.towers) do
@ -190,7 +191,6 @@ local function game_serialize()
end end
end end
-- @TODO b64 encode or otherwise scramble/compress
return am.to_json(serialized) return am.to_json(serialized)
end end
@ -640,7 +640,6 @@ function update_money(diff) state.money = state.money + diff end
function game_end() function game_end()
state = {} state = {}
game = false game = false
-- @TODO anything
end end
function game_save() function game_save()

6
src/grid.lua

@ -172,8 +172,8 @@ function map_elevation_color(elevation)
else else
-- @TODO probably fix... this only happens when loading a save, and the tile has an elevation that's -- @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
end end
@ -258,6 +258,6 @@ function random_map(seed)
end end
end end
return map, make_hex_grid_scene(map)
return map
end end

6
src/mob.lua

@ -7,7 +7,7 @@ MOB_TYPE = {
MAX_MOB_SIZE = hex_height(HEX_SIZE, HEX_ORIENTATION.FLAT) / 2 MAX_MOB_SIZE = hex_height(HEX_SIZE, HEX_ORIENTATION.FLAT) / 2
MOB_SIZE = MAX_MOB_SIZE MOB_SIZE = MAX_MOB_SIZE
MOB_SPECS = {
local MOB_SPECS = {
[MOB_TYPE.BEEPER] = { [MOB_TYPE.BEEPER] = {
health = 30, health = 30,
speed = 8, 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) return spec_health + math.pow(state.current_wave - 1, 2)
end end
local function grow_mob_speed(mob_type, spec_speed, time) 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 end
local function grow_mob_bounty(mob_type, spec_bounty, time) local function grow_mob_bounty(mob_type, spec_bounty, time)
return spec_bounty + math.pow(state.current_wave - 1, 2) return spec_bounty + math.pow(state.current_wave - 1, 2)

6
src/tower.lua

@ -12,7 +12,7 @@ TOWER_TYPE = {
LIGHTHOUSE = 6 LIGHTHOUSE = 6
} }
TOWER_SPECS = {
local TOWER_SPECS = {
[TOWER_TYPE.WALL] = { [TOWER_TYPE.WALL] = {
name = "Wall", name = "Wall",
placement_rules_text = "Place on Ground", placement_rules_text = "Place on Ground",
@ -31,7 +31,7 @@ TOWER_SPECS = {
short_description = "Fires area of effect artillery.", short_description = "Fires area of effect artillery.",
texture = TEXTURES.TOWER_HOWITZER, texture = TEXTURES.TOWER_HOWITZER,
icon_texture = TEXTURES.TOWER_HOWITZER_ICON, icon_texture = TEXTURES.TOWER_HOWITZER_ICON,
cost = 20,
cost = 30,
range = 6, range = 6,
fire_rate = 4, fire_rate = 4,
size = 0, size = 0,
@ -79,7 +79,7 @@ TOWER_SPECS = {
short_description = "Attracts nearby mobs; temporarily redirects their path", short_description = "Attracts nearby mobs; temporarily redirects their path",
texture = TEXTURES.TOWER_LIGHTHOUSE, texture = TEXTURES.TOWER_LIGHTHOUSE,
icon_texture = TEXTURES.TOWER_LIGHTHOUSE_ICON, icon_texture = TEXTURES.TOWER_LIGHTHOUSE_ICON,
cost = 20,
cost = 70,
range = 7, range = 7,
fire_rate = 1, fire_rate = 1,
size = 0, size = 0,

2
texture.lua

@ -65,7 +65,7 @@ function pack_texture_into_sprite(texture, width, height, color)
y1 = 0, y2 = height, height = height y1 = 0, y2 = height, height = height
} }
if color then sprite.color end
if color then sprite.color = color end
return sprite return sprite
end end

Loading…
Cancel
Save