From 348bd4fe64fc8c1d6964269bd0b0e662353cdbee Mon Sep 17 00:00:00 2001 From: assada Date: Tue, 24 Feb 2026 12:48:00 +0100 Subject: [PATCH] =?UTF-8?q?cleanup:=20QOL=20improvements=20=E2=80=94=20git?= =?UTF-8?q?ignore,=20Tags=20constants,=20remove=20debug=20artifacts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add .DS_Store, unused/, .vscode/settings.json to .gitignore - Add .editorconfig (tabs for Lua, LF, UTF-8) - Fix duplicate submodule entry in .gitmodules - Add Tags table (player, tank, ground, granade, ammoCrate) — replace magic numbers - Add SCREEN_W/SCREEN_H constants - Fix leaked global variable `c` in Game.lua - Remove Noble.showFPS = true from BomberScene - Remove debug print() calls from granade, enemy, BomberScene - Fix clean_build_dir glob bug in both build scripts - Make PLAYDATE_SDK_PATH configurable via env var --- .DS_Store | Bin 10244 -> 0 bytes .editorconfig | 16 ++++++++++++++++ .gitignore | 15 ++++++++++++++- .gitmodules | 3 --- build_and_run.sh | 4 ++-- build_and_run_mac.sh | 4 ++-- source/assets/.DS_Store | Bin 6148 -> 0 bytes .../fonts/Mini Sans 2X-table-18-20.png | Bin source/assets/images/.DS_Store | Bin 6148 -> 0 bytes source/main.lua | 11 +++++++++++ source/scenes/Game.lua | 2 +- source/scenes/bomber/BomberScene.lua | 5 ++--- source/scripts/bomber/ammoCrate.lua | 4 ++-- source/scripts/bomber/enemy.lua | 6 ++---- source/scripts/bomber/granade.lua | 5 +---- source/scripts/player.lua | 8 ++++---- source/scripts/tankSprite.lua | 2 +- 17 files changed, 58 insertions(+), 27 deletions(-) delete mode 100644 .DS_Store create mode 100644 .editorconfig delete mode 100644 source/assets/.DS_Store rename source/assets/{unused => }/fonts/Mini Sans 2X-table-18-20.png (100%) delete mode 100644 source/assets/images/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index c40f011280ee0e55797a6707506c045cb7162886..0000000000000000000000000000000000000000 GIT binary patch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+bd9%v+ZgLTD5pWT35ttK!0?zfb`~U9Q|Nqa~hRbvja1r=_BY=g$P_UD1$Q&Q@ z&0%-#etP!O!xEDl=hRlA7ZYLi_H{fJ*meAJr!I4{X8eFtH_oZ8PW84rQGT0$$A1Q- V%-cUux#$18a%<+E|L@HC|6hKxheiMZ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0d211b6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[*.sh] +indent_style = space +indent_size = 4 diff --git a/.gitignore b/.gitignore index b205ba3..f826e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,14 @@ -builds/* +builds/ +source/assets/unused/ + +# OS +.DS_Store +Thumbs.db + +# IDE (machine-specific) +.vscode/settings.json + +# Editors +*.swp +*.swo +*~ diff --git a/.gitmodules b/.gitmodules index 0d31a0f..d58a343 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "Noble Engine"] - path = source/libraries/noble - url = https://github.com/NobleRobot/NobleEngine.git [submodule "source/libraries/noble"] path = source/libraries/noble url = https://github.com/NobleRobot/NobleEngine.git diff --git a/build_and_run.sh b/build_and_run.sh index eed4319..2890636 100755 --- a/build_and_run.sh +++ b/build_and_run.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export PLAYDATE_SDK_PATH="/home/ut3usw/PlaydateSDK-2.5.0" +export PLAYDATE_SDK_PATH="${PLAYDATE_SDK_PATH:-/home/ut3usw/PlaydateSDK-2.5.0}" # Check for color by variable and tput command if [[ -z $NOCOLOR && -n $(command -v tput) ]]; then @@ -103,7 +103,7 @@ function make_build_dir() { function clean_build_dir() { if [[ -d "${BUILD_DIR}" ]]; then log "Cleaning build directory..." - rm -rfv "${BUILD_DIR}/*" + rm -rfv "${BUILD_DIR}"/* chk_err fi } diff --git a/build_and_run_mac.sh b/build_and_run_mac.sh index 304e721..cb85088 100755 --- a/build_and_run_mac.sh +++ b/build_and_run_mac.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export PLAYDATE_SDK_PATH="/Users/oleksiiilienko/Developer/PlaydateSDK" +export PLAYDATE_SDK_PATH="${PLAYDATE_SDK_PATH:-/Users/oleksiiilienko/Developer/PlaydateSDK}" # Check for color by variable and tput command if [[ -z $NOCOLOR && -n $(command -v tput) ]]; then @@ -103,7 +103,7 @@ function make_build_dir() { function clean_build_dir() { if [[ -d "${BUILD_DIR}" ]]; then log "Cleaning build directory..." - rm -rfv "${BUILD_DIR}/*" + rm -rfv "${BUILD_DIR}"/* chk_err fi } diff --git a/source/assets/.DS_Store b/source/assets/.DS_Store deleted file mode 100644 index 0674314a08ccbd947f307113897e92e0f86da9b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKL2uJA6n^g7HD#LA14z3dMdDgUyH3-lT|yZLt^~mWP)U~3MWk`nr1Vf#${GFx ze}OB%g#W?`zGr(1fA25SM5a^JbB;raTGNy+>55mWs%3+D z<#lai1?O1H7`kt%sosK5rMIBQ{?~e*9uIr&{lTB=S({Z&Q3!V9%)DI=?*Z1V0#*U5 zKv@CaA6z)2XRy$ywhjb!1pqcttqf&8{yE1r=ou_Dq6H>&Dp02ibHxxk9rdo^c?JuO zI-P{MdIqm5Ppt3XwO9sStl^Z)U$@Bh^#`(zcc3fw3KMDxPG z7-350Y~7k1pS3Rh4V;a6g+`TvV2)!|;G_5et_*E17l59@LL+Km_K$#)!3L|qUsd1- D(*omR diff --git a/source/assets/unused/fonts/Mini Sans 2X-table-18-20.png b/source/assets/fonts/Mini Sans 2X-table-18-20.png similarity index 100% rename from source/assets/unused/fonts/Mini Sans 2X-table-18-20.png rename to source/assets/fonts/Mini Sans 2X-table-18-20.png diff --git a/source/assets/images/.DS_Store b/source/assets/images/.DS_Store deleted file mode 100644 index b5eb54de9826adc703f78e3a327eef42f199d01f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%SyvQ6rE|KO({Ya3SADkE!c+?i<=PZ4;ayfN=-=7V45jSY8R!Dwf>M_;`ey( z%tS2Kt%$uBX3l-iWDaB=j4|%bqYh&ZW6Xwz$WhrK=-wErm}EqbV}y%r8YVIX`_07u zI^efkY{CLIW!cy752s0-MSn8x5}Iq0@q z;<(pet?Kr{;nC^E=qZ_`@ 0 then for i, collision in ipairs(collisions) do - if collision.other:getTag() == 154 and collision.other.currentRadius <= 0.05 then + if collision.other:getTag() == Tags.granade and collision.other.currentRadius <= 0.05 then self:pickup() return end diff --git a/source/scripts/bomber/enemy.lua b/source/scripts/bomber/enemy.lua index ed9754c..e49c066 100644 --- a/source/scripts/bomber/enemy.lua +++ b/source/scripts/bomber/enemy.lua @@ -65,8 +65,7 @@ function Enemy:update() if numberOfCollisions > 0 then for i, collision in ipairs(collisions) do - if collision.other:getTag() == 154 and collision.other.currentRadius <= 0.05 and not self.isDying then - print("Collision with granade") + if collision.other:getTag() == Tags.granade and collision.other.currentRadius <= 0.05 and not self.isDying then self:setImage(self.deadImage) self.hitSound:play() self:applyExplosionForce(collision.other.x, collision.other.y) @@ -74,9 +73,8 @@ function Enemy:update() end end - if self.y > 240 + 10 then + if self.y > SCREEN_H + 10 then if not self.removed then - print("Removing enemy") self:remove() self:superRemove() self.removed = true diff --git a/source/scripts/bomber/granade.lua b/source/scripts/bomber/granade.lua index 9287a8d..d61c3c5 100644 --- a/source/scripts/bomber/granade.lua +++ b/source/scripts/bomber/granade.lua @@ -23,7 +23,7 @@ function Granade:init(x, y) self:setSize(size, size) self:moveTo(x, y) self:setZIndex(10) - self:setTag(154) + self:setTag(Tags.granade) self:setCenter(0.5, 0.5) self:setGroups(CollideGroups.granade) self:setCollidesWithGroups({ @@ -31,8 +31,6 @@ function Granade:init(x, y) }) self:setCollideRect(0, 0, self:getSize()) - print("Granade init") - print(self.x, self.y) self:add(x, y) self:markDirty() end @@ -56,7 +54,6 @@ function Granade:update() self.currentRadius = self.currentRadius - self.shrinkRate if self.currentRadius <= 0 then - print("Granade deactivated") self.isActive = false local particleB = ParticlePoly(self.x, self.y) particleB:setThickness(1) diff --git a/source/scripts/player.lua b/source/scripts/player.lua index 34b153c..4ef59bf 100644 --- a/source/scripts/player.lua +++ b/source/scripts/player.lua @@ -30,7 +30,7 @@ function Player:init(x, y) CollideGroups.wall }) self:setCollideRect(3, 19, 60, 33) - self:setTag(1) + self:setTag(Tags.player) -- Physics properties self.fallSpeed = 0.05 @@ -188,13 +188,13 @@ function Player:handleMovementAndCollisions() end end - if collisionTag == 3 then -- Ground + if collisionTag == Tags.ground then self:boom() return - elseif collisionTag == 154 then -- Baleba + elseif collisionTag == Tags.granade then self:boom(collisionObject) return - elseif collisionTag == 2 then -- Tank + elseif collisionTag == Tags.tank then self:boom() BigBoom() diff --git a/source/scripts/tankSprite.lua b/source/scripts/tankSprite.lua index 738992b..f2e1fb9 100644 --- a/source/scripts/tankSprite.lua +++ b/source/scripts/tankSprite.lua @@ -10,7 +10,7 @@ function Tank:init(x, y, ground) -- Collision properties self:setZIndex(ZIndex.enemy) - self:setTag(2) + self:setTag(Tags.tank) self:setCollideRect(4, 56, 147, 65) self:setGroups(CollideGroups.enemy) self:setCollidesWithGroups(