Nicholas Hayashi 3 years ago
parent
commit
1298c25133
  1. 3
      src/game.lua
  2. 7
      src/grid.lua
  3. 11
      src/mob.lua

3
src/game.lua

@ -96,7 +96,8 @@ local function get_break_time(current_wave)
end end
local function do_day_night_cycle() local function do_day_night_cycle()
--
-- this is a bad idea, atleast with the current bad rendering strategy of not using a single draw call
-- i get flickering as the light level increases
--local tstep = (math.sin(state.time * am.delta_time) + 1) / 100 --local tstep = (math.sin(state.time * am.delta_time) + 1) / 100
--state.world"negative_mask".color = vec4(tstep){a=1} --state.world"negative_mask".color = vec4(tstep){a=1}
end end

7
src/grid.lua

@ -38,7 +38,7 @@ end
-- amulet puts 0,0 in the middle of the screen -- amulet puts 0,0 in the middle of the screen
-- transform coordinates by this to pretend 0,0 is elsewhere -- transform coordinates by this to pretend 0,0 is elsewhere
-- note this is isn't necessary when adding stuff to the worldspace in general, -- note this is isn't necessary when adding stuff to the worldspace in general,
-- because the whole worldspace is translated by this constant
-- because the worldspace parent node should be translated by this constant
WORLDSPACE_COORDINATE_OFFSET = -HEX_GRID_PIXEL_DIMENSIONS/2 WORLDSPACE_COORDINATE_OFFSET = -HEX_GRID_PIXEL_DIMENSIONS/2
-- the outer edges of the map are not interactable -- the outer edges of the map are not interactable
@ -69,9 +69,6 @@ HEX_GRID_MAXIMUM_ELEVATION = 1
function grid_cost(map, from, to) function grid_cost(map, from, to)
local t1, t2 = hex_map_get(map, from), hex_map_get(map, to) local t1, t2 = hex_map_get(map, from), hex_map_get(map, to)
-- i have no fucking clue why, but adding +0.2 to the end of this fixes a bug where sometimes two (or more)
-- equivalent paths are found and mobs backpedal trying to decide between them
-- (seed 2014 at time of writing has this at the bottom)
local elevation_epsilon = HEX_GRID_MAXIMUM_ELEVATION - HEX_GRID_MINIMUM_ELEVATION + 0.2 local elevation_epsilon = HEX_GRID_MAXIMUM_ELEVATION - HEX_GRID_MINIMUM_ELEVATION + 0.2
local elevation_cost = 2 + math.abs(t1.elevation)^0.5 - math.abs(t2.elevation)^0.5 local elevation_cost = 2 + math.abs(t1.elevation)^0.5 - math.abs(t2.elevation)^0.5
@ -171,7 +168,7 @@ function map_elevation_color(elevation)
return COLORS.MOUNTAIN{ ra = elevation } return COLORS.MOUNTAIN{ ra = elevation }
else else
-- @TODO probably fix... this only happens when loading a save, and the tile has an elevation that's
-- this only happens when loading a save, and the tile has an elevation that's
-- higher that anything here. it isn't really of any consequence though -- higher that anything here. it isn't really of any consequence though
return vec4(0) return vec4(0)
end end

11
src/mob.lua

@ -25,7 +25,7 @@ local MOB_SPECS = {
health = 10, health = 10,
speed = 20, speed = 20,
bounty = 40, bounty = 40,
hurtbox_radius = MOB_SIZE/2 - 2
hurtbox_radius = MOB_SIZE
}, },
} }
@ -107,7 +107,7 @@ function make_mob_node(mob_type, mob)
if mob_type == MOB_TYPE.BEEPER then if mob_type == MOB_TYPE.BEEPER then
return am.group{ return am.group{
am.rotate(am.current_time()) -- state.time is not garunteed to be set when deserializing
am.rotate(mob.TOB)
^ pack_texture_into_sprite(TEXTURES.MOB_BEEPER, MOB_SIZE, MOB_SIZE), ^ pack_texture_into_sprite(TEXTURES.MOB_BEEPER, MOB_SIZE, MOB_SIZE),
am.translate(0, -10) am.translate(0, -10)
^ healthbar ^ healthbar
@ -122,7 +122,7 @@ function make_mob_node(mob_type, mob)
elseif mob_type == MOB_TYPE.VELKOOZ then elseif mob_type == MOB_TYPE.VELKOOZ then
return am.group{ return am.group{
am.rotate(0) am.rotate(0)
^ pack_texture_into_sprite(TEXTURES.MOB_VELKOOZ, MOB_SIZE*2, MOB_SIZE*2):tag"velk_sprite",
^ pack_texture_into_sprite(TEXTURES.MOB_VELKOOZ, MOB_SIZE*4, MOB_SIZE*4):tag"velk_sprite",
am.translate(0, -10) am.translate(0, -10)
^ healthbar ^ healthbar
} }
@ -390,11 +390,10 @@ end
function do_mob_spawning() function do_mob_spawning()
if can_spawn_mob() then if can_spawn_mob() then
make_and_register_mob(MOB_TYPE.VELKOOZ)
if state.current_wave % 2 == 0 then if state.current_wave % 2 == 0 then
--make_and_register_mob(MOB_TYPE.SPOODER)
make_and_register_mob(MOB_TYPE.SPOODER)
else else
--make_and_register_mob(MOB_TYPE.BEEPER)
make_and_register_mob(MOB_TYPE.BEEPER)
end end
end end
end end

Loading…
Cancel
Save