This commit is contained in:
assada 2025-04-11 15:15:19 +02:00
parent 95b2c825db
commit 648e4a3dc4
No known key found for this signature in database
GPG Key ID: 0464CAD9AD2FA347
7 changed files with 167 additions and 6 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -29,6 +29,7 @@
"runtime.version": "Lua 5.4", "runtime.version": "Lua 5.4",
"workspace.library": [ "workspace.library": [
"/Users/oleksiiilienko/projects/playdate-luacats", "/Users/oleksiiilienko/projects/playdate-luacats",
"/Users/oleksiiilienko/Documents/fpv2/source/libraries" "/Users/oleksiiilienko/Documents/fpv2/source/libraries",
"/Users/oleksiiilienko/Documents/fpv2/source"
] ]
} }

View File

@ -94,6 +94,8 @@ import "scripts/selectionSprite"
import "scripts/DroneCard" import "scripts/DroneCard"
import "scripts/pageSprite" import "scripts/pageSprite"
import "scripts/MapCard" import "scripts/MapCard"
import "scripts/bomber/movableCrosshair"
import "scripts/bomber/granade"
import "scenes/BaseScene" import "scenes/BaseScene"
import 'scenes/Assemble' import 'scenes/Assemble'
@ -101,6 +103,7 @@ import 'scenes/DroneCardSelector'
import 'scenes/Menu' import 'scenes/Menu'
import 'scenes/Game' import 'scenes/Game'
import 'scenes/MapSelector' import 'scenes/MapSelector'
import 'scenes/bomber/BomberScene'
Difficulty = { Difficulty = {
Easy = "Easy", Easy = "Easy",
@ -126,7 +129,7 @@ DifficultySettings = {
Noble.Settings.setup({ Noble.Settings.setup({
difficulty = Difficulty.Medium, difficulty = Difficulty.Medium,
music = true, music = true,
debug = true debug = false
}) })
Noble.GameData.setup({ Noble.GameData.setup({
@ -141,4 +144,4 @@ playdate.display.setRefreshRate(50)
Noble.showFPS = false Noble.showFPS = false
Noble.new(Menu) Noble.new(BomberScene)

View File

@ -0,0 +1,47 @@
BomberScene = {}
class("BomberScene").extends(BaseScene)
local scene = BomberScene
function scene:init()
scene.super.init(self)
scene.granade = nil
end
scene.inputHandler = {
upButtonHold = function()
scene.crosshair:moveUp()
end,
downButtonHold = function()
scene.crosshair:moveDown()
end,
leftButtonHold = function()
scene.crosshair:moveLeft()
end,
rightButtonHold = function()
scene.crosshair:moveRight()
end,
AButtonDown = function()
print("AButtonDown")
scene.granade = Granade(scene.crosshair.x, scene.crosshair.y)
end
}
function scene:enter()
scene.super.enter(self)
Noble.Input.setHandler(scene.inputHandler)
scene.crosshair = MovableCrosshair(100, 100)
end
function scene:start()
scene.super.start(self)
end
function scene:update()
scene.super.update(self)
-- scene.crosshair:update()
-- if scene.granade then
-- scene.granade:update()
-- end
end

View File

@ -0,0 +1,34 @@
Granade = {}
class('Granade').extends(NobleSprite)
function Granade:init(x, y)
Granade.super.init(self)
self.initialRadius = 10
self.currentRadius = self.initialRadius
self.shrinkRate = 0.2
self.isActive = true
self:moveTo(x, y)
print("Granade init")
print(self.x, self.y)
end
function Granade:update()
if self.isActive then
self.currentRadius = self.currentRadius - self.shrinkRate
if self.currentRadius <= 0 then
print("Granade deactivated")
self.isActive = false
self:remove()
end
end
self:draw()
end
function Granade:draw()
playdate.graphics.fillCircleAtPoint(self.x, self.y, self.currentRadius)
end

View File

@ -0,0 +1,76 @@
MovableCrosshair = {}
class('MovableCrosshair').extends(NobleSprite)
function MovableCrosshair:init()
MovableCrosshair.super.init(self)
-- Parameters for crosshair
self.lineLength = 10
self.gapSize = 3
-- Parameters for movement
self.baseX = 200
self.baseY = 150
self.moveRadius = 2
self.moveSpeed = 2
self.time = 0
end
function MovableCrosshair:update()
-- Update time
self.time = self.time + playdate.display.getRefreshRate() / 1000
-- Calculate new position with slight movement
local offsetX = math.sin(self.time) * self.moveRadius
local offsetY = math.cos(self.time * 1.3) * self.moveRadius
self:moveTo(self.baseX + offsetX, self.baseY + offsetY)
self:draw()
end
function MovableCrosshair:draw()
-- Draw horizontal lines
playdate.graphics.drawLine(
self.x - self.lineLength - self.gapSize, self.y,
self.x - self.gapSize, self.y
)
playdate.graphics.drawLine(
self.x + self.gapSize, self.y,
self.x + self.lineLength + self.gapSize, self.y
)
-- Draw vertical lines
playdate.graphics.drawLine(
self.x, self.y - self.lineLength - self.gapSize,
self.x, self.y - self.gapSize
)
playdate.graphics.drawLine(
self.x, self.y + self.gapSize,
self.x, self.y + self.lineLength + self.gapSize
)
end
function MovableCrosshair:moveUp()
if self.baseY > 5 then
self.baseY = self.baseY - 1
end
end
function MovableCrosshair:moveDown()
if self.baseY < 235 then
self.baseY = self.baseY + 1
end
end
function MovableCrosshair:moveLeft()
if self.baseX > 5 then
self.baseX = self.baseX - 1
end
end
function MovableCrosshair:moveRight()
if self.baseX < 395 then
self.baseX = self.baseX + 1
end
end

View File

@ -192,9 +192,9 @@ function Player:handleMovementAndCollisions()
self:boom() self:boom()
return return
elseif collisionTag == 154 then -- Baleba elseif collisionTag == 154 then -- Baleba
if self.debug then -- if self.debug then TODO: why debug always true?
return -- return
end -- end
self:boom(collisionObject) self:boom(collisionObject)
return return
elseif collisionTag == 2 then -- Tank elseif collisionTag == 2 then -- Tank