Nicholas Hayashi 3 years ago
parent
commit
3bccce9777
  1. 2
      .gitignore
  2. 5
      README.md
  3. 4
      build.sh
  4. 3
      main.lua
  5. BIN
      res/Sprite-0002.aseprite
  6. BIN
      res/radar2.png
  7. BIN
      res/radar3.png
  8. BIN
      res/tower_radar4.png
  9. 15
      src/hexyz.lua
  10. 2
      src/mob.lua
  11. 2
      src/projectile.lua
  12. 2
      src/tower.lua
  13. 6
      texture.lua

2
.gitignore

@ -1,3 +1,3 @@
bin/
build/
.DS_Store .DS_Store
log.txt log.txt

5
README.md

@ -2,10 +2,7 @@
## INTRODUCTION ## INTRODUCTION
This is a tower defense game. It's made using lua, and the amulet game engine made by Ian Maclarty. 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 ## RESOURCES

4
build.sh

@ -1,4 +1,4 @@
# add -mac, -windows, -linux, or -html if you only want one target # 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 .

3
main.lua

@ -69,7 +69,7 @@ do
mode = settings.fullscreen and "fullscreen" or "windowed", mode = settings.fullscreen and "fullscreen" or "windowed",
resizable = true, resizable = true,
highdpi = 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, letterbox = true,
show_cursor = true, show_cursor = true,
} }
@ -92,7 +92,6 @@ require "src/mob"
require "src/projectile" require "src/projectile"
require "src/tower" require "src/tower"
-- text popup in the middle of the screen that dissapates, call from anywhere -- text popup in the middle of the screen that dissapates, call from anywhere
function alert(message, color) function alert(message, color)
win.scene:append( win.scene:append(

BIN
res/Sprite-0002.aseprite

BIN
res/radar2.png

After

Width: 835  |  Height: 832  |  Size: 350 KiB

BIN
res/radar3.png

After

Width: 377  |  Height: 389  |  Size: 105 KiB

BIN
res/tower_radar4.png

After

Width: 202  |  Height: 192  |  Size: 50 KiB

15
src/hexyz.lua

@ -9,11 +9,7 @@
-- table.append -- 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 -- @TODO
if not table.append then end if not table.append then end
@ -126,12 +122,13 @@ function hex_neighbours(hex)
return neighbours return neighbours
end 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| -- 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 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 xdelta = math.abs(rx - x)
local ydelta = math.abs(ry - y) local ydelta = math.abs(ry - y)

2
src/mob.lua

@ -1,6 +1,4 @@
state.mobs = {}
MOB_TYPE = { MOB_TYPE = {
BEEPER = 1, BEEPER = 1,
SPOODER = 2 SPOODER = 2

2
src/projectile.lua

@ -1,6 +1,4 @@
state.projectiles = {}
PROJECTILE_TYPE = { PROJECTILE_TYPE = {
SHELL = 1, SHELL = 1,
LASER = 2, LASER = 2,

2
src/tower.lua

@ -1,6 +1,4 @@
state.towers = {}
TOWER_TYPE = { TOWER_TYPE = {
WALL = 1, WALL = 1,
HOWITZER = 2, HOWITZER = 2,

6
texture.lua

@ -9,7 +9,6 @@ local function load_texture(filepath)
end end
end end
TEXTURES = { TEXTURES = {
-- note that in amulet, if you prefix paths with './', they fail to be found in the exported data.pak -- 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"), LOGO = load_texture("res/logo.png"),
@ -46,7 +45,7 @@ TEXTURES = {
TOWER_REDEYE_ICON = load_texture("res/tower_redeye_icon.png"), TOWER_REDEYE_ICON = load_texture("res/tower_redeye_icon.png"),
TOWER_MOAT = load_texture("res/tower_moat.png"), TOWER_MOAT = load_texture("res/tower_moat.png"),
TOWER_MOAT_ICON = load_texture("res/tower_moat_icon.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_RADAR_ICON = load_texture("res/tower_radar_icon.png"),
TOWER_LIGHTHOUSE = load_texture("res/tower_lighthouse.png"), TOWER_LIGHTHOUSE = load_texture("res/tower_lighthouse.png"),
TOWER_LIGHTHOUSE_ICON = load_texture("res/tower_lighthouse_icon.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 y1 = 0, y2 = height, height = height
} }
sprite.color = color or vec4(1)
if color then sprite.color end
return sprite return sprite
end end
Loading…
Cancel
Save