Browse Source

remove radar

master
Nicholas Hayashi 3 years ago
parent
commit
430edd0274
  1. 3
      src/entity.lua
  2. 4
      src/game.lua
  3. 38
      src/tower.lua

3
src/entity.lua

@ -51,7 +51,8 @@ end
function delete_entity(t, index) function delete_entity(t, index)
if not t then error("splat!") end if not t then error("splat!") end
game_state.world:remove(t[index].node)
local entity = t[index]
game_state.world(world_layer_tag(entity.z)):remove(entity.node)
t[index] = false -- leave empty indexes so other entities can learn that this entity was deleted t[index] = false -- leave empty indexes so other entities can learn that this entity was deleted
end end

4
src/game.lua

@ -66,8 +66,8 @@ local game_scene_menu_options = {
} }
local function get_initial_game_state(seed) local function get_initial_game_state(seed)
local STARTING_MONEY = 75
--local STARTING_MONEY = 10000
--local STARTING_MONEY = 75
local STARTING_MONEY = 10000
local map = random_map(seed) local map = random_map(seed)
local world = make_hex_grid_scene(map, true) local world = make_hex_grid_scene(map, true)

38
src/tower.lua

@ -280,21 +280,6 @@ function init_tower_specs()
end, end,
update_f = false update_f = false
}, },
{
id = "RADAR",
name = "Radar",
placement_rules_text = "n/a",
short_description = "Doesn't do anything right now :(",
texture = TEXTURES.TOWER_RADAR,
icon_texture = TEXTURES.TOWER_RADAR_ICON,
cost = 100,
range = 0,
fire_rate = 1,
make_node_f = function(self)
return make_tower_sprite(self)
end,
update_f = false
},
{ {
id = "LIGHTHOUSE", id = "LIGHTHOUSE",
name = "Lighthouse", name = "Lighthouse",
@ -306,7 +291,11 @@ function init_tower_specs()
range = 7, range = 7,
fire_rate = 1, fire_rate = 1,
height = 2, height = 2,
make_node_f = function(self)
make_node_f = function(self, hex)
if hex then
self.perimeter = hex_spiral_map(hex, 6)
end
return am.group( return am.group(
make_tower_sprite(self), make_tower_sprite(self),
am.particles2d{ am.particles2d{
@ -380,6 +369,9 @@ function init_tower_specs()
cost = 50, cost = 50,
size = 2, size = 2,
height = 0, height = 0,
props = {
income = 1
},
make_node_f = function(self) make_node_f = function(self)
local quads = am.quads(2*7, {"vert", "vec2", "uv", "vec2", "color", "vec4"}) local quads = am.quads(2*7, {"vert", "vec2", "uv", "vec2", "color", "vec4"})
@ -389,6 +381,16 @@ function init_tower_specs()
end end
return am.blend("alpha") ^ am.use_program(make_hex_shader_program_node()) ^ am.bind{ texture = TEXTURES.TOWER_FARM } ^ quads return am.blend("alpha") ^ am.use_program(make_hex_shader_program_node()) ^ am.bind{ texture = TEXTURES.TOWER_FARM } ^ quads
end,
update_f = function(tower, tower_index)
for _,h in pairs(tower.hexes) do
for _,m in pairs(mobs_on_hex(h)) do
if m then
tower.props.income = tower.props.income * 0.7
end
end
end
game_state.money = game_state.money + tower.props.income * am.delta_time
end end
} }
} }
@ -576,7 +578,9 @@ function make_and_register_tower(hex, tower_type)
local spec = get_tower_spec(tower_type) local spec = get_tower_spec(tower_type)
local tower = make_basic_entity( local tower = make_basic_entity(
hex, hex,
spec.update_f
spec.update_f,
false,
math.clamp(spec.height, 0, 10)
) )
table.merge(tower, spec) table.merge(tower, spec)

Loading…
Cancel
Save