Browse Source

remove some files, fix lighthouse bug

master
Nicholas Hayashi 4 years ago
parent
commit
28a12c2410
  1. 36
      NOTES.md
  2. 5
      README.md
  3. 24
      TODO.md
  4. 4
      main.lua
  5. 8
      src/game.lua
  6. 6
      src/mob.lua
  7. 8
      src/projectile.lua
  8. 6
      src/tower.lua

36
NOTES.md

@ -1,36 +0,0 @@
SEEED 1835 has bad start
@TODO test optimizing pathfinding via breadth first search/djikstra
MAP RESOURCES
- spawn diamonds or special floating resources that give you bonuses for building on, whether it's score, money, or boosting the effectiveness of the tower you place on top, etc.
- killing certain mobs may cause these resources to spawn on the hex they died on
towers:
- redeye
long-range laser tower
only buildable on mountains and upgraded walls
- lighthouse
light-emitting static tower
only buildable on tiles adjacent to water
mobs strongly prefer to path around lighthouses
- wall
some fraction of the height of the tallest mountain
makes mob pathing more difficult
upgrades:
- fortifications - lets you build some qualifying towers on top of this tower
- spikes - mobs take damage when climbing
- moat
some fraction of the depth of the deepest lake
makes mob pathing more difficult
upgrades:
- alligators - mobs take damage while swimming

5
README.md

@ -1,7 +1,10 @@
## INTRODUCTION
This is a tower defense game.
This is a tower defense game. It's made using lua, and the amulet game engine made by Ian Maclarty.
If you are interested in a library of code for dealing with hexagonal grids/geometry in your game, the file src/hexyz.lua may be of interest to you, as may be the resources below.
## RESOURCES

24
TODO.md

@ -1,24 +0,0 @@
- fix lighthouse pathing recusrive bug thing
- make more towers
- make/fix radar tower
- do waves
- make mob difficulty scale
towers:
1 - wall
2 - howitzer
3 -
4 - redeye
q -
w - moat
e -
r - radar
a -
s - lighthouse
d - not a tower, deselects current selection
f -

4
main.lua

@ -206,8 +206,8 @@ function main_scene(do_backdrop, do_logo)
end
group:append(
am.translate(win.right - 10, win.bottom + 20)
^ am.text(version, COLORS.WHITE, "right")
am.translate(win.right - 10, win.bottom + 10)
^ am.text(string.format("v%s, by %s", version, author), COLORS.WHITE, "right", "bottom")
)
if do_logo then

8
src/game.lua

@ -28,7 +28,7 @@ local TRDTS = {
local function get_initial_game_state(seed)
local STARTING_MONEY = 200
-- 2014
local map, world = random_map()
return {
@ -41,9 +41,9 @@ local function get_initial_game_state(seed)
score = 0, -- current game score
money = STARTING_MONEY, -- current money
towers = {},
mobs = {},
projectiles = {},
towers = {}, -- list of tower entities
mobs = {}, -- list of mob entities
projectiles = {}, -- list of projectile entities
current_wave = 1,
time_until_next_wave = 0,

6
src/mob.lua

@ -33,15 +33,15 @@ function get_mob_spec(mob_type)
end
local function grow_mob_health(mob_type, spec_health, time)
return spec_health * (time / 100 + 1)
return spec_health + (state.current_wave - 1) * 3
end
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 --* math.abs(math.log(time / 100))
return spec_speed
end
local function grow_mob_bounty(mob_type, spec_bounty, time)
return spec_bounty * (time / 100 + 1)
return spec_bounty + (state.current_wave - 1) * 3
end
function mobs_on_hex(hex)

8
src/projectile.lua

@ -10,13 +10,13 @@ PROJECTILE_TYPE = {
local PROJECTILE_SPECS = {
[PROJECTILE_TYPE.SHELL] = {
velocity = 13,
damage = 15,
damage = 10,
hitbox_radius = 20
},
[PROJECTILE_TYPE.LASER] = {
velocity = 25,
damage = 5,
hitbox_radius = 10
velocity = 35,
damage = 20,
hitbox_radius = 20
},
}

6
src/tower.lua

@ -66,8 +66,8 @@ TOWER_SPECS = {
},
[TOWER_TYPE.RADAR] = {
name = "Radar",
placement_rules_text = "Place on any non-Water",
short_description = "Provides information about incoming waves.",
placement_rules_text = "n/a",
short_description = "Doesn't do anything right now :(",
texture = TEXTURES.TOWER_RADAR,
icon_texture = TEXTURES.TOWER_RADAR_ICON,
cost = 20,
@ -441,7 +441,7 @@ function update_tower_lighthouse(tower, tower_index)
-- is within some angle range...? if the mob is heading directly away from the tower, then
-- the lighthouse shouldn't do much
local path, made_it = hex_Astar(state.map, tower.hex, m.hex, grid_neighbours, grid_cost, heuristic)
local path, made_it = hex_Astar(state.map, tower.hex, m.hex, grid_neighbours, grid_cost, grid_heuristic)
if made_it then
m.path = path

Loading…
Cancel
Save