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:
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@@ -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
|
||||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -1 +1,14 @@
|
|||||||
builds/*
|
builds/
|
||||||
|
source/assets/unused/
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# IDE (machine-specific)
|
||||||
|
.vscode/settings.json
|
||||||
|
|
||||||
|
# Editors
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,6 +1,3 @@
|
|||||||
[submodule "Noble Engine"]
|
|
||||||
path = source/libraries/noble
|
|
||||||
url = https://github.com/NobleRobot/NobleEngine.git
|
|
||||||
[submodule "source/libraries/noble"]
|
[submodule "source/libraries/noble"]
|
||||||
path = source/libraries/noble
|
path = source/libraries/noble
|
||||||
url = https://github.com/NobleRobot/NobleEngine.git
|
url = https://github.com/NobleRobot/NobleEngine.git
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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
|
# Check for color by variable and tput command
|
||||||
if [[ -z $NOCOLOR && -n $(command -v tput) ]]; then
|
if [[ -z $NOCOLOR && -n $(command -v tput) ]]; then
|
||||||
@@ -103,7 +103,7 @@ function make_build_dir() {
|
|||||||
function clean_build_dir() {
|
function clean_build_dir() {
|
||||||
if [[ -d "${BUILD_DIR}" ]]; then
|
if [[ -d "${BUILD_DIR}" ]]; then
|
||||||
log "Cleaning build directory..."
|
log "Cleaning build directory..."
|
||||||
rm -rfv "${BUILD_DIR}/*"
|
rm -rfv "${BUILD_DIR}"/*
|
||||||
chk_err
|
chk_err
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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
|
# Check for color by variable and tput command
|
||||||
if [[ -z $NOCOLOR && -n $(command -v tput) ]]; then
|
if [[ -z $NOCOLOR && -n $(command -v tput) ]]; then
|
||||||
@@ -103,7 +103,7 @@ function make_build_dir() {
|
|||||||
function clean_build_dir() {
|
function clean_build_dir() {
|
||||||
if [[ -d "${BUILD_DIR}" ]]; then
|
if [[ -d "${BUILD_DIR}" ]]; then
|
||||||
log "Cleaning build directory..."
|
log "Cleaning build directory..."
|
||||||
rm -rfv "${BUILD_DIR}/*"
|
rm -rfv "${BUILD_DIR}"/*
|
||||||
chk_err
|
chk_err
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
source/assets/.DS_Store
vendored
BIN
source/assets/.DS_Store
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
BIN
source/assets/images/.DS_Store
vendored
BIN
source/assets/images/.DS_Store
vendored
Binary file not shown.
@@ -36,6 +36,17 @@ CollideGroups = {
|
|||||||
granade = 6
|
granade = 6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tags = {
|
||||||
|
player = 1,
|
||||||
|
tank = 2,
|
||||||
|
ground = 3,
|
||||||
|
granade = 154,
|
||||||
|
ammoCrate = 155,
|
||||||
|
}
|
||||||
|
|
||||||
|
SCREEN_W = 400
|
||||||
|
SCREEN_H = 240
|
||||||
|
|
||||||
Maps = {
|
Maps = {
|
||||||
{
|
{
|
||||||
id = 1,
|
id = 1,
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ function scene:update()
|
|||||||
Noble.GameData.set("money", Noble.GameData.get("money") + reward)
|
Noble.GameData.set("money", Noble.GameData.get("money") + reward)
|
||||||
message = "You did it! +$" .. reward
|
message = "You did it! +$" .. reward
|
||||||
end
|
end
|
||||||
c = notify(message, function()
|
local c = notify(message, function()
|
||||||
Noble.transition(DroneCardSelector)
|
Noble.transition(DroneCardSelector)
|
||||||
c:remove()
|
c:remove()
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ scene.inputHandler = {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
print("AButtonDown")
|
|
||||||
if not scene.grenadeCooldown then
|
if not scene.grenadeCooldown then
|
||||||
Granade(scene.crosshair.x, scene.crosshair.y)
|
Granade(scene.crosshair.x, scene.crosshair.y)
|
||||||
scene.grenadeCooldown = true
|
scene.grenadeCooldown = true
|
||||||
@@ -144,13 +143,13 @@ end
|
|||||||
function scene:start()
|
function scene:start()
|
||||||
scene.super.start(self)
|
scene.super.start(self)
|
||||||
self.optionsMenu:addMenuItem("Main Menu", function() Noble.transition(Menu) end)
|
self.optionsMenu:addMenuItem("Main Menu", function() Noble.transition(Menu) end)
|
||||||
Noble.showFPS = true
|
Noble.showFPS = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene:hasActiveGrenades()
|
function scene:hasActiveGrenades()
|
||||||
local sprites = playdate.graphics.sprite.getAllSprites()
|
local sprites = playdate.graphics.sprite.getAllSprites()
|
||||||
for i = 1, #sprites do
|
for i = 1, #sprites do
|
||||||
if sprites[i]:getTag() == 154 then
|
if sprites[i]:getTag() == Tags.granade then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function AmmoCrate:init(x, y)
|
|||||||
self:setGroups(CollideGroups.props)
|
self:setGroups(CollideGroups.props)
|
||||||
self:setCollidesWithGroups({ CollideGroups.granade })
|
self:setCollidesWithGroups({ CollideGroups.granade })
|
||||||
self:setCollideRect(0, 0, self.crateSize, self.crateSize)
|
self:setCollideRect(0, 0, self.crateSize, self.crateSize)
|
||||||
self:setTag(155)
|
self:setTag(Tags.ammoCrate)
|
||||||
|
|
||||||
self.removed = false
|
self.removed = false
|
||||||
self.bonusGrenades = 3
|
self.bonusGrenades = 3
|
||||||
@@ -30,7 +30,7 @@ function AmmoCrate:update()
|
|||||||
local _, _, collisions, count = self:checkCollisions(self.x, self.y)
|
local _, _, collisions, count = self:checkCollisions(self.x, self.y)
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
for i, collision in ipairs(collisions) do
|
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()
|
self:pickup()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ function Enemy:update()
|
|||||||
|
|
||||||
if numberOfCollisions > 0 then
|
if numberOfCollisions > 0 then
|
||||||
for i, collision in ipairs(collisions) do
|
for i, collision in ipairs(collisions) do
|
||||||
if collision.other:getTag() == 154 and collision.other.currentRadius <= 0.05 and not self.isDying then
|
if collision.other:getTag() == Tags.granade and collision.other.currentRadius <= 0.05 and not self.isDying then
|
||||||
print("Collision with granade")
|
|
||||||
self:setImage(self.deadImage)
|
self:setImage(self.deadImage)
|
||||||
self.hitSound:play()
|
self.hitSound:play()
|
||||||
self:applyExplosionForce(collision.other.x, collision.other.y)
|
self:applyExplosionForce(collision.other.x, collision.other.y)
|
||||||
@@ -74,9 +73,8 @@ function Enemy:update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.y > 240 + 10 then
|
if self.y > SCREEN_H + 10 then
|
||||||
if not self.removed then
|
if not self.removed then
|
||||||
print("Removing enemy")
|
|
||||||
self:remove()
|
self:remove()
|
||||||
self:superRemove()
|
self:superRemove()
|
||||||
self.removed = true
|
self.removed = true
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function Granade:init(x, y)
|
|||||||
self:setSize(size, size)
|
self:setSize(size, size)
|
||||||
self:moveTo(x, y)
|
self:moveTo(x, y)
|
||||||
self:setZIndex(10)
|
self:setZIndex(10)
|
||||||
self:setTag(154)
|
self:setTag(Tags.granade)
|
||||||
self:setCenter(0.5, 0.5)
|
self:setCenter(0.5, 0.5)
|
||||||
self:setGroups(CollideGroups.granade)
|
self:setGroups(CollideGroups.granade)
|
||||||
self:setCollidesWithGroups({
|
self:setCollidesWithGroups({
|
||||||
@@ -31,8 +31,6 @@ function Granade:init(x, y)
|
|||||||
})
|
})
|
||||||
self:setCollideRect(0, 0, self:getSize())
|
self:setCollideRect(0, 0, self:getSize())
|
||||||
|
|
||||||
print("Granade init")
|
|
||||||
print(self.x, self.y)
|
|
||||||
self:add(x, y)
|
self:add(x, y)
|
||||||
self:markDirty()
|
self:markDirty()
|
||||||
end
|
end
|
||||||
@@ -56,7 +54,6 @@ function Granade:update()
|
|||||||
self.currentRadius = self.currentRadius - self.shrinkRate
|
self.currentRadius = self.currentRadius - self.shrinkRate
|
||||||
|
|
||||||
if self.currentRadius <= 0 then
|
if self.currentRadius <= 0 then
|
||||||
print("Granade deactivated")
|
|
||||||
self.isActive = false
|
self.isActive = false
|
||||||
local particleB = ParticlePoly(self.x, self.y)
|
local particleB = ParticlePoly(self.x, self.y)
|
||||||
particleB:setThickness(1)
|
particleB:setThickness(1)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function Player:init(x, y)
|
|||||||
CollideGroups.wall
|
CollideGroups.wall
|
||||||
})
|
})
|
||||||
self:setCollideRect(3, 19, 60, 33)
|
self:setCollideRect(3, 19, 60, 33)
|
||||||
self:setTag(1)
|
self:setTag(Tags.player)
|
||||||
|
|
||||||
-- Physics properties
|
-- Physics properties
|
||||||
self.fallSpeed = 0.05
|
self.fallSpeed = 0.05
|
||||||
@@ -188,13 +188,13 @@ function Player:handleMovementAndCollisions()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if collisionTag == 3 then -- Ground
|
if collisionTag == Tags.ground then
|
||||||
self:boom()
|
self:boom()
|
||||||
return
|
return
|
||||||
elseif collisionTag == 154 then -- Baleba
|
elseif collisionTag == Tags.granade then
|
||||||
self:boom(collisionObject)
|
self:boom(collisionObject)
|
||||||
return
|
return
|
||||||
elseif collisionTag == 2 then -- Tank
|
elseif collisionTag == Tags.tank then
|
||||||
self:boom()
|
self:boom()
|
||||||
BigBoom()
|
BigBoom()
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function Tank:init(x, y, ground)
|
|||||||
|
|
||||||
-- Collision properties
|
-- Collision properties
|
||||||
self:setZIndex(ZIndex.enemy)
|
self:setZIndex(ZIndex.enemy)
|
||||||
self:setTag(2)
|
self:setTag(Tags.tank)
|
||||||
self:setCollideRect(4, 56, 147, 65)
|
self:setCollideRect(4, 56, 147, 65)
|
||||||
self:setGroups(CollideGroups.enemy)
|
self:setGroups(CollideGroups.enemy)
|
||||||
self:setCollidesWithGroups(
|
self:setCollidesWithGroups(
|
||||||
|
|||||||
Reference in New Issue
Block a user