diff --git a/.gitignore b/.gitignore index 6e886fc..99e02e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -bin/ +build/ .DS_Store log.txt diff --git a/README.md b/README.md index 288c4ac..37d1de4 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,7 @@ ## INTRODUCTION 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. - - - +If you are interested in a library of code for dealing with hexagonal grids/geometry in your (amulet or lua based) game, the file src/hexyz.lua may be of interest to you, as may be the resources below. ## RESOURCES diff --git a/build.sh b/build.sh index c31e397..c537003 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ # add -mac, -windows, -linux, or -html if you only want one target -rm -r bin/* -amulet export -r -d bin/ -a . +rm -r build/* +amulet export -r -d build/ -a . diff --git a/main.lua b/main.lua index 1c3acce..c426d36 100644 --- a/main.lua +++ b/main.lua @@ -69,7 +69,7 @@ do mode = settings.fullscreen and "fullscreen" or "windowed", resizable = true, highdpi = true, - resizable = true, -- user should probably set their resolution instead of resizing the window, but hey. + --resizable = true, -- user should probably set their resolution instead of resizing the window, but hey. letterbox = true, show_cursor = true, } @@ -92,7 +92,6 @@ require "src/mob" require "src/projectile" require "src/tower" - -- text popup in the middle of the screen that dissapates, call from anywhere function alert(message, color) win.scene:append( diff --git a/res/Sprite-0002.aseprite b/res/Sprite-0002.aseprite new file mode 100644 index 0000000..eed5b31 Binary files /dev/null and b/res/Sprite-0002.aseprite differ diff --git a/res/radar2.png b/res/radar2.png new file mode 100644 index 0000000..5e6c3bd Binary files /dev/null and b/res/radar2.png differ diff --git a/res/radar3.png b/res/radar3.png new file mode 100644 index 0000000..a41277d Binary files /dev/null and b/res/radar3.png differ diff --git a/res/tower_radar4.png b/res/tower_radar4.png new file mode 100644 index 0000000..1b1e481 Binary files /dev/null and b/res/tower_radar4.png differ diff --git a/src/hexyz.lua b/src/hexyz.lua index 76ca6cc..2bedf07 100644 --- a/src/hexyz.lua +++ b/src/hexyz.lua @@ -9,11 +9,7 @@ -- table.append -if not math.round then - math.round = function(n) return math.floor(n + 0.5) end -else - error("clobbering 'math.round', oopsie!") -end + -- @TODO if not table.append then end @@ -126,12 +122,13 @@ function hex_neighbours(hex) return neighbours end +local function round(n) return math.floor(n + 0.5) end + -- Returns a vec2 Which is the Nearest |x, y| to Float Trio |x, y, z| --- assumes you have a working math.round function (should be guarded at top of this file) local function hex_round(x, y, z) - local rx = math.round(x) - local ry = math.round(y) - local rz = math.round(z) or math.round(-x - y) + local rx = round(x) + local ry = round(y) + local rz = round(z) or round(-x - y) local xdelta = math.abs(rx - x) local ydelta = math.abs(ry - y) diff --git a/src/mob.lua b/src/mob.lua index 6fa3527..bf2bbaf 100644 --- a/src/mob.lua +++ b/src/mob.lua @@ -1,6 +1,4 @@ -state.mobs = {} - MOB_TYPE = { BEEPER = 1, SPOODER = 2 diff --git a/src/projectile.lua b/src/projectile.lua index 5319ea2..e6c5671 100644 --- a/src/projectile.lua +++ b/src/projectile.lua @@ -1,6 +1,4 @@ -state.projectiles = {} - PROJECTILE_TYPE = { SHELL = 1, LASER = 2, diff --git a/src/tower.lua b/src/tower.lua index b9b9e3d..c4bb802 100644 --- a/src/tower.lua +++ b/src/tower.lua @@ -1,6 +1,4 @@ -state.towers = {} - TOWER_TYPE = { WALL = 1, HOWITZER = 2, diff --git a/texture.lua b/texture.lua index 7b9bb20..730e7b7 100644 --- a/texture.lua +++ b/texture.lua @@ -9,7 +9,6 @@ local function load_texture(filepath) end end - TEXTURES = { -- note that in amulet, if you prefix paths with './', they fail to be found in the exported data.pak LOGO = load_texture("res/logo.png"), @@ -46,7 +45,7 @@ TEXTURES = { TOWER_REDEYE_ICON = load_texture("res/tower_redeye_icon.png"), TOWER_MOAT = load_texture("res/tower_moat.png"), TOWER_MOAT_ICON = load_texture("res/tower_moat_icon.png"), - TOWER_RADAR = load_texture("res/tower_radar.png"), + TOWER_RADAR = load_texture("res/tower_radar4.png"), TOWER_RADAR_ICON = load_texture("res/tower_radar_icon.png"), TOWER_LIGHTHOUSE = load_texture("res/tower_lighthouse.png"), TOWER_LIGHTHOUSE_ICON = load_texture("res/tower_lighthouse_icon.png"), @@ -66,7 +65,8 @@ function pack_texture_into_sprite(texture, width, height, color) y1 = 0, y2 = height, height = height } - sprite.color = color or vec4(1) + if color then sprite.color end + return sprite end