diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..643d1f3 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc5f9c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/ +log.txt diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..992f258 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +amulet export -r -d bin/ -mac -a . diff --git a/src/color.lua b/color.lua similarity index 100% rename from src/color.lua rename to color.lua diff --git a/conf.lua b/conf.lua new file mode 100644 index 0000000..70efd8c --- /dev/null +++ b/conf.lua @@ -0,0 +1,13 @@ + +title = "hexyz" +author = "nick hayashi" +shortname = "hexyz" +version = "1.0.0" +support_email = "hayashi.nicholas@gmail.com" +copyright_message = "Copyright © 2021 Nick Hayashi" + +dev_region = "en" +supported_languages = "en" + +luavm = "luajit" + diff --git a/src/main.lua b/main.lua similarity index 95% rename from src/main.lua rename to main.lua index 10271a2..139fe89 100644 --- a/src/main.lua +++ b/main.lua @@ -6,11 +6,18 @@ math.random() math.random() require "color" -require "entity" -require "grid" -require "mob" -require "projectile" -require "tower" +require "sound" +require "texture" + +require "src/hexyz" +require "src/entity" +require "src/extra" +require "src/grid" +require "src/gui" +require "src/mob" +require "src/projectile" +require "src/tower" + -- Globals WIN = am.window{ @@ -72,6 +79,7 @@ local function game_action(scene) pause() elseif WIN:key_pressed"f2" then + delete_all_entities() WIN.scene = game_scene() elseif WIN:key_pressed"f3" then diff --git a/src/sound.lua b/sound.lua similarity index 90% rename from src/sound.lua rename to sound.lua index 8fd0082..ff6ab41 100644 --- a/src/sound.lua +++ b/sound.lua @@ -16,7 +16,7 @@ SOUNDS = { RANDOM5 = 36680709, -- audio buffers - TRACK1 = am.track(am.load_audio("../res/track1.ogg"), true, 1, 0.1) + TRACK1 = am.track(am.load_audio("./res/track1.ogg"), true, 1, 0.1) } -- play a sound with variable pitch diff --git a/src/grid.lua b/src/grid.lua index a0b19fb..2ea2459 100644 --- a/src/grid.lua +++ b/src/grid.lua @@ -1,8 +1,5 @@ -require "gui" -require "hexyz" - HEX_SIZE = 20 -- with 1920x1080, this is the minimal dimensions to cover the screen (65x33) diff --git a/src/mob.lua b/src/mob.lua index c55d261..fe80ac5 100644 --- a/src/mob.lua +++ b/src/mob.lua @@ -1,9 +1,5 @@ -require "extra" -require "sound" - - -- @NOTE returns i,v in the table function mob_on_hex(hex) return table.find(ENTITIES, function(entity) diff --git a/src/texture.lua b/src/texture.lua deleted file mode 100644 index 56fbcf9..0000000 --- a/src/texture.lua +++ /dev/null @@ -1,24 +0,0 @@ - - -function load_textures() - TEX_MARQUIS = am.texture2d("../res/marquis.png") - - TEX_ARROW = am.texture2d("../res/arrow.png") - - TEX_WALL_CLOSED = am.texture2d("../res/wall_closed.png") - TEX_TOWER1 = am.texture2d("../res/tower1.png") - TEX_TOWER2 = am.texture2d("../res/tower2.png") - - TEX_MOB1_1 = am.texture2d("../res/mob1_1.png") - TEX_MOB2_1 = am.texture2d("../res/mob2_1.png") -end - -function pack_texture_into_sprite(texture, width, height) - return am.sprite{ - texture = texture, - s1 = 0, s2 = 1, t1 = 0, t2 = 1, - x1 = 0, x2 = width, width = width, - y1 = 0, y2 = height, height = height - } -end - diff --git a/texture.lua b/texture.lua new file mode 100644 index 0000000..269f6f1 --- /dev/null +++ b/texture.lua @@ -0,0 +1,24 @@ + + +function load_textures() + TEX_MARQUIS = am.texture2d("./res/marquis.png") + + TEX_ARROW = am.texture2d("./res/arrow.png") + + TEX_WALL_CLOSED = am.texture2d("./res/wall_closed.png") + TEX_TOWER1 = am.texture2d("./res/tower1.png") + TEX_TOWER2 = am.texture2d("./res/tower2.png") + + TEX_MOB1_1 = am.texture2d("./res/mob1_1.png") + TEX_MOB2_1 = am.texture2d("./res/mob2_1.png") +end + +function pack_texture_into_sprite(texture, width, height) + return am.sprite{ + texture = texture, + s1 = 0, s2 = 1, t1 = 0, t2 = 1, + x1 = 0, x2 = width, width = width, + y1 = 0, y2 = height, height = height + } +end +