cleanup: QOL improvements — gitignore, Tags constants, remove debug artifacts
- 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
This commit is contained in:
@@ -11,7 +11,7 @@ function AmmoCrate:init(x, y)
|
||||
self:setGroups(CollideGroups.props)
|
||||
self:setCollidesWithGroups({ CollideGroups.granade })
|
||||
self:setCollideRect(0, 0, self.crateSize, self.crateSize)
|
||||
self:setTag(155)
|
||||
self:setTag(Tags.ammoCrate)
|
||||
|
||||
self.removed = false
|
||||
self.bonusGrenades = 3
|
||||
@@ -30,7 +30,7 @@ function AmmoCrate:update()
|
||||
local _, _, collisions, count = self:checkCollisions(self.x, self.y)
|
||||
if count > 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user