Browse Source

lighthouses flash when they attract a mob

master
Nicholas Hayashi 4 years ago
parent
commit
80185a7543
  1. 12
      main.lua
  2. BIN
      res/Sprite-0001.aseprite
  3. BIN
      res/mountain1.png
  4. BIN
      res/mountain2.png
  5. BIN
      res/tower_lighthouse_icon.png
  6. BIN
      res/tower_moat_icon.png
  7. BIN
      res/tower_redeye_icon.png
  8. BIN
      res/tower_wall1.png
  9. BIN
      res/tower_wall2.png
  10. BIN
      res/tower_wall3.png
  11. BIN
      res/tower_wall4.png
  12. BIN
      res/tower_wall5.png
  13. BIN
      res/tower_wall6.png
  14. BIN
      res/tower_wall_icon.png
  15. 2
      src/grid.lua
  16. 2
      src/gui.lua
  17. 17
      src/tower.lua
  18. 6
      texture.lua

12
main.lua

@ -102,16 +102,6 @@ local function game_action(scene)
end end
end end
--[[
if WIN:mouse_pressed"middle" then
WORLD"scale".scale2d = vec2(1)
else
local mwd = vec2(WIN:mouse_wheel_delta().y / 500)
WORLD"scale".scale2d = WORLD"scale".scale2d + mwd
WORLD"scale".scale2d = WORLD"scale".scale2d + mwd
end
]]
if WIN:key_pressed"escape" then if WIN:key_pressed"escape" then
WIN.scene"game".paused = true WIN.scene"game".paused = true
WIN.scene:append(am.group{ WIN.scene:append(am.group{
@ -125,7 +115,6 @@ local function game_action(scene)
return true return true
end end
end) end)
elseif WIN:key_pressed"f1" then elseif WIN:key_pressed"f1" then
TRDT = (TRDT + 1) % #table.keys(TRDTS) TRDT = (TRDT + 1) % #table.keys(TRDTS)
@ -139,7 +128,6 @@ local function game_action(scene)
else else
select_tower_type((SELECTED_TOWER_TYPE) % num_of_types + 1) select_tower_type((SELECTED_TOWER_TYPE) % num_of_types + 1)
end end
elseif WIN:key_pressed"1" then select_tower_type(TOWER_TYPE.REDEYE) elseif WIN:key_pressed"1" then select_tower_type(TOWER_TYPE.REDEYE)
elseif WIN:key_pressed"2" then select_tower_type(2) elseif WIN:key_pressed"2" then select_tower_type(2)
elseif WIN:key_pressed"3" then select_tower_type(3) elseif WIN:key_pressed"3" then select_tower_type(3)

BIN
res/Sprite-0001.aseprite

BIN
res/mountain1.png

Before

Width: 188  |  Height: 164  |  Size: 61 KiB

BIN
res/mountain2.png

Before

Width: 189  |  Height: 163  |  Size: 69 KiB

BIN
res/tower_lighthouse_icon.png

After

Width: 64  |  Height: 64  |  Size: 796 B

BIN
res/tower_moat_icon.png

After

Width: 137  |  Height: 137  |  Size: 1.4 KiB

BIN
res/tower_redeye_icon.png

After

Width: 64  |  Height: 64  |  Size: 637 B

BIN
res/tower_wall1.png

Before

Width: 100  |  Height: 88  |  Size: 2.0 KiB

BIN
res/tower_wall2.png

Before

Width: 100  |  Height: 88  |  Size: 1.8 KiB

BIN
res/tower_wall3.png

Before

Width: 100  |  Height: 88  |  Size: 2.0 KiB

BIN
res/tower_wall4.png

Before

Width: 100  |  Height: 88  |  Size: 2.0 KiB

BIN
res/tower_wall5.png

Before

Width: 100  |  Height: 88  |  Size: 2.0 KiB

BIN
res/tower_wall6.png

Before

Width: 100  |  Height: 88  |  Size: 2.0 KiB

BIN
res/tower_wall_icon.png

After

Width: 126  |  Height: 131  |  Size: 1.4 KiB

2
src/grid.lua

@ -53,7 +53,7 @@ function evenq_is_interactable(evenq)
}) })
end end
local function tile_is_medium_elevation(tile)
function tile_is_medium_elevation(tile)
return tile.elevation >= -0.5 and tile.elevation < 0.5 return tile.elevation >= -0.5 and tile.elevation < 0.5
end end

2
src/gui.lua

@ -109,7 +109,7 @@ function toolbelt()
button( button(
size, size,
half_size, half_size,
get_tower_texture(tower_type_values[i]),
get_tower_icon_texture(tower_type_values[i]),
padding, padding,
i, i,
offset, offset,

17
src/tower.lua

@ -15,6 +15,7 @@ TOWER_SPECS = {
placement_rules_text = "Place on mountains or on Walls", placement_rules_text = "Place on mountains or on Walls",
short_description = "Long range laser tower", short_description = "Long range laser tower",
texture = TEXTURES.TOWER_REDEYE, texture = TEXTURES.TOWER_REDEYE,
icon_texture = TEXTURES.TOWER_REDEYE_ICON,
base_cost = 25, base_cost = 25,
}, },
[TOWER_TYPE.LIGHTHOUSE] = { [TOWER_TYPE.LIGHTHOUSE] = {
@ -22,6 +23,7 @@ TOWER_SPECS = {
placement_rules_text = "Place next to - but not on - water or moats", placement_rules_text = "Place next to - but not on - water or moats",
short_description = "Attracts and distracts mobs", short_description = "Attracts and distracts mobs",
texture = TEXTURES.TOWER_LIGHTHOUSE, texture = TEXTURES.TOWER_LIGHTHOUSE,
icon_texture = TEXTURES.TOWER_LIGHTHOUSE_ICON,
base_cost = 25 base_cost = 25
}, },
[TOWER_TYPE.WALL] = { [TOWER_TYPE.WALL] = {
@ -29,6 +31,7 @@ TOWER_SPECS = {
placement_rules_text = "Place on grass or dirt", placement_rules_text = "Place on grass or dirt",
short_description = "Restricts movement", short_description = "Restricts movement",
texture = TEXTURES.TOWER_WALL, texture = TEXTURES.TOWER_WALL,
icon_texture = TEXTURES.TOWER_WALL_ICON,
base_cost = 5, base_cost = 5,
}, },
[TOWER_TYPE.MOAT] = { [TOWER_TYPE.MOAT] = {
@ -36,6 +39,7 @@ TOWER_SPECS = {
placement_rules_text = "Place on grass or dirt", placement_rules_text = "Place on grass or dirt",
short_description = "Restricts movement", short_description = "Restricts movement",
texture = TEXTURES.TOWER_MOAT, texture = TEXTURES.TOWER_MOAT,
icon_texture = TEXTURES.TOWER_MOAT_ICON,
base_cost = 5, base_cost = 5,
} }
} }
@ -52,6 +56,9 @@ end
function get_tower_texture(tower_type) function get_tower_texture(tower_type)
return TOWER_SPECS[tower_type] and TOWER_SPECS[tower_type].texture return TOWER_SPECS[tower_type] and TOWER_SPECS[tower_type].texture
end end
function get_tower_icon_texture(tower_type)
return TOWER_SPECS[tower_type] and TOWER_SPECS[tower_type].icon_texture
end
function get_tower_base_cost(tower_type) function get_tower_base_cost(tower_type)
return TOWER_SPECS[tower_type] and TOWER_SPECS[tower_type].base_cost return TOWER_SPECS[tower_type] and TOWER_SPECS[tower_type].base_cost
end end
@ -194,6 +201,16 @@ function update_tower_lighthouse(tower, tower_index)
if made_it then if made_it then
m.path = path m.path = path
local area = spiral_map(tower.hex, tower.range)
for _,h in pairs(area) do
local node = HEX_MAP[h.x][h.y].node"circle"
local initial_color = node.color
node:late_action(am.series{
am.tween(node, 0.1, { color = COLORS.SUNRAY }),
am.tween(node, 0.1, { color = initial_color })
})
end
end end
end end
end end

6
texture.lua

@ -11,8 +11,10 @@ TEXTURES = {
TOWER_WALL = am.texture2d("res/tower_wall.png"), TOWER_WALL = am.texture2d("res/tower_wall.png"),
TOWER_MOAT = am.texture2d("res/tower_moat.png"), TOWER_MOAT = am.texture2d("res/tower_moat.png"),
MOUNTAIN1 = am.texture2d("res/mountain1.png"),
MOUNTAIN2 = am.texture2d("res/mountain2.png"),
TOWER_REDEYE_ICON = am.texture2d("res/tower_redeye_icon.png"),
TOWER_LIGHTHOUSE_ICON = am.texture2d("res/tower_lighthouse_icon.png"),
TOWER_WALL_ICON = am.texture2d("res/tower_wall_icon.png"),
TOWER_MOAT_ICON = am.texture2d("res/tower_moat_icon.png"),
MOB_BEEPER = am.texture2d("res/mob_beeper.png"), MOB_BEEPER = am.texture2d("res/mob_beeper.png"),
} }

Loading…
Cancel
Save