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)
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
end

4
src/game.lua

@ -66,8 +66,8 @@ local game_scene_menu_options = {
}
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 world = make_hex_grid_scene(map, true)

38
src/tower.lua

@ -280,21 +280,6 @@ function init_tower_specs()
end,
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",
name = "Lighthouse",
@ -306,7 +291,11 @@ function init_tower_specs()
range = 7,
fire_rate = 1,
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(
make_tower_sprite(self),
am.particles2d{
@ -380,6 +369,9 @@ function init_tower_specs()
cost = 50,
size = 2,
height = 0,
props = {
income = 1
},
make_node_f = function(self)
local quads = am.quads(2*7, {"vert", "vec2", "uv", "vec2", "color", "vec4"})
@ -389,6 +381,16 @@ function init_tower_specs()
end
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
}
}
@ -576,7 +578,9 @@ function make_and_register_tower(hex, tower_type)
local spec = get_tower_spec(tower_type)
local tower = make_basic_entity(
hex,
spec.update_f
spec.update_f,
false,
math.clamp(spec.height, 0, 10)
)
table.merge(tower, spec)

Loading…
Cancel
Save