redesign music and drone selection
BIN
source/assets/audio/assemble.wav
Normal file
BIN
source/assets/audio/menu.wav
Normal file
BIN
source/assets/images/card.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
source/assets/images/card1.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
source/assets/images/card2.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
source/assets/images/card3.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
source/assets/images/card4.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
source/assets/images/card_1.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
source/assets/images/card_2.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
source/assets/images/card_3.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
source/assets/images/card_4.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
source/assets/sprites/pages-table-64-64.png
Normal file
After Width: | Height: | Size: 989 B |
@ -36,6 +36,7 @@ CollideGroups = {
|
|||||||
|
|
||||||
Drones = {
|
Drones = {
|
||||||
{
|
{
|
||||||
|
id = 1,
|
||||||
name = "Quad FPV",
|
name = "Quad FPV",
|
||||||
description =
|
description =
|
||||||
"This is a quadrocopter with a camera on it. It's a good drone for beginners. It's easy to control and has a good battery life.",
|
"This is a quadrocopter with a camera on it. It's a good drone for beginners. It's easy to control and has a good battery life.",
|
||||||
@ -45,6 +46,7 @@ Drones = {
|
|||||||
full = Graphics.image.new("assets/sprites/assemble/1/8.png")
|
full = Graphics.image.new("assets/sprites/assemble/1/8.png")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id = 2,
|
||||||
name = "Drone 2",
|
name = "Drone 2",
|
||||||
description = "This is a drone",
|
description = "This is a drone",
|
||||||
price = 200,
|
price = 200,
|
||||||
@ -53,6 +55,7 @@ Drones = {
|
|||||||
full = nil
|
full = nil
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id = 3,
|
||||||
name = "Drone 3",
|
name = "Drone 3",
|
||||||
description = "This is a drone",
|
description = "This is a drone",
|
||||||
price = 300,
|
price = 300,
|
||||||
@ -61,6 +64,7 @@ Drones = {
|
|||||||
full = nil
|
full = nil
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id = 4,
|
||||||
name = "Drone 4",
|
name = "Drone 4",
|
||||||
description = "This is a drone",
|
description = "This is a drone",
|
||||||
price = 400,
|
price = 400,
|
||||||
@ -78,10 +82,13 @@ import "scripts/dangerSprite"
|
|||||||
import "scripts/tankSprite"
|
import "scripts/tankSprite"
|
||||||
import "scripts/progressBar"
|
import "scripts/progressBar"
|
||||||
import "scripts/selectionSprite"
|
import "scripts/selectionSprite"
|
||||||
|
import "scripts/DroneCard"
|
||||||
|
import "scripts/pageSprite"
|
||||||
|
|
||||||
import "scenes/BaseScene"
|
import "scenes/BaseScene"
|
||||||
import 'scenes/Assemble'
|
import 'scenes/Assemble'
|
||||||
import 'scenes/DroneSelection'
|
import 'scenes/DroneSelection'
|
||||||
|
import 'scenes/DroneCardSelector'
|
||||||
import 'scenes/Menu'
|
import 'scenes/Menu'
|
||||||
import 'scenes/Game'
|
import 'scenes/Game'
|
||||||
|
|
||||||
@ -118,6 +125,6 @@ Noble.GameData.setup({
|
|||||||
|
|
||||||
playdate.display.setRefreshRate(50)
|
playdate.display.setRefreshRate(50)
|
||||||
|
|
||||||
Noble.showFPS = true
|
Noble.showFPS = false
|
||||||
|
|
||||||
Noble.new(Menu)
|
Noble.new(Menu)
|
||||||
|
@ -8,6 +8,9 @@ local fontMed = Graphics.font.new('assets/fonts/onyx_9')
|
|||||||
local allButtons = { "A", "B", "DOWN", "LEFT", "RIGHT", "UP" }
|
local allButtons = { "A", "B", "DOWN", "LEFT", "RIGHT", "UP" }
|
||||||
|
|
||||||
function scene:popCode(button)
|
function scene:popCode(button)
|
||||||
|
if #scene.code == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
scene.menuConfirmSound:stop()
|
scene.menuConfirmSound:stop()
|
||||||
if scene.tickTimer.paused then
|
if scene.tickTimer.paused then
|
||||||
scene.droneParts = scene:loadDrone(1, #scene.code)
|
scene.droneParts = scene:loadDrone(1, #scene.code)
|
||||||
@ -35,7 +38,14 @@ function scene:popCode(button)
|
|||||||
end
|
end
|
||||||
|
|
||||||
scene.inputHandler = {
|
scene.inputHandler = {
|
||||||
AButtonDown = function() scene:popCode("A") end,
|
AButtonDown = function()
|
||||||
|
if #scene.code == 0 then
|
||||||
|
scene.menuConfirmSound:play(1)
|
||||||
|
Noble.transition(Game, nil, Noble.Transition.SpotlightMask)
|
||||||
|
else
|
||||||
|
scene:popCode("A")
|
||||||
|
end
|
||||||
|
end,
|
||||||
BButtonDown = function() scene:popCode("B") end,
|
BButtonDown = function() scene:popCode("B") end,
|
||||||
downButtonDown = function() scene:popCode("DOWN") end,
|
downButtonDown = function() scene:popCode("DOWN") end,
|
||||||
leftButtonDown = function() scene:popCode("LEFT") end,
|
leftButtonDown = function() scene:popCode("LEFT") end,
|
||||||
@ -95,6 +105,11 @@ function scene:setValues()
|
|||||||
|
|
||||||
scene.menuConfirmSound = playdate.sound.fileplayer.new("assets/audio/confirm")
|
scene.menuConfirmSound = playdate.sound.fileplayer.new("assets/audio/confirm")
|
||||||
self.aKey = Graphics.image.new("assets/sprites/buttons/A")
|
self.aKey = Graphics.image.new("assets/sprites/buttons/A")
|
||||||
|
|
||||||
|
scene.musicEnabled = Noble.Settings.get("music")
|
||||||
|
|
||||||
|
scene.levelAudio = playdate.sound.fileplayer.new("assets/audio/assemble")
|
||||||
|
scene.levelAudio:setVolume(0.7)
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene:init()
|
function scene:init()
|
||||||
@ -120,11 +135,19 @@ 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:enter()
|
function scene:enter()
|
||||||
scene.super.enter(self)
|
scene.super.enter(self)
|
||||||
|
|
||||||
|
scene.buttonTimeout = 100
|
||||||
|
|
||||||
|
Noble.Input.setHandler(scene.inputHandler)
|
||||||
|
|
||||||
|
if scene.musicEnabled then
|
||||||
|
scene.levelAudio:play(0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function round(number)
|
function round(number)
|
||||||
@ -155,13 +178,6 @@ function scene:update()
|
|||||||
yEnd = 100,
|
yEnd = 100,
|
||||||
invert = false
|
invert = false
|
||||||
})
|
})
|
||||||
scene.inputHandler = {
|
|
||||||
AButtonDown = function()
|
|
||||||
Noble.transition(Game, nil, Noble.Transition.SpotlightMask)
|
|
||||||
scene.menuConfirmSound:play(1)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
Noble.Input.setHandler(scene.inputHandler)
|
|
||||||
self.aKey:draw(200, 170 + dy)
|
self.aKey:draw(200, 170 + dy)
|
||||||
Noble.Text.draw("Start Mission", 218, 175, Noble.Text.ALIGN_LEFT, false, fontMed)
|
Noble.Text.draw("Start Mission", 218, 175, Noble.Text.ALIGN_LEFT, false, fontMed)
|
||||||
self.progressBar:remove()
|
self.progressBar:remove()
|
||||||
@ -210,7 +226,7 @@ end
|
|||||||
|
|
||||||
function scene:exit()
|
function scene:exit()
|
||||||
scene.super.exit(self)
|
scene.super.exit(self)
|
||||||
|
scene.levelAudio:stop()
|
||||||
Noble.showFPS = false
|
Noble.showFPS = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
115
source/scenes/DroneCardSelector.lua
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
DroneCardSelector = {}
|
||||||
|
class("DroneCardSelector").extends(BaseScene)
|
||||||
|
local scene = DroneCardSelector
|
||||||
|
local fontMed = Graphics.font.new('assets/fonts/onyx_9')
|
||||||
|
local elapsedTime = 0
|
||||||
|
|
||||||
|
scene.inputHandler = {
|
||||||
|
AButtonDown = function()
|
||||||
|
scene.menuConfirmSound:play(1)
|
||||||
|
Noble.transition(Assemble)
|
||||||
|
end,
|
||||||
|
BButtonDown = function() end,
|
||||||
|
downButtonDown = function()
|
||||||
|
end,
|
||||||
|
leftButtonDown = function()
|
||||||
|
if scene.menuIndex <= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
scene.menuSelSound:play(1)
|
||||||
|
scene.targetX = scene.targetX + 355
|
||||||
|
scene.menuIndex = scene.menuIndex - 1
|
||||||
|
scene.paginator:set(scene.menuIndex)
|
||||||
|
end,
|
||||||
|
rightButtonDown = function()
|
||||||
|
if scene.menuIndex >= 4 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
scene.menuSelSound:play(1)
|
||||||
|
scene.targetX = scene.targetX - 355
|
||||||
|
scene.menuIndex = scene.menuIndex + 1
|
||||||
|
scene.paginator:set(scene.menuIndex)
|
||||||
|
end,
|
||||||
|
upButtonDown = function()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
function scene:setValues()
|
||||||
|
self.menuIndex = 1
|
||||||
|
|
||||||
|
self.aKey = Graphics.image.new("assets/sprites/buttons/A")
|
||||||
|
scene.menuConfirmSound = playdate.sound.fileplayer.new("assets/audio/confirm")
|
||||||
|
|
||||||
|
scene.menuSelSound = playdate.sound.fileplayer.new("assets/audio/menu_select")
|
||||||
|
scene.menuSelSound:setVolume(0.5)
|
||||||
|
|
||||||
|
scene.currentX = 0
|
||||||
|
scene.targetX = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene:init()
|
||||||
|
scene.super.init(self)
|
||||||
|
scene:setValues()
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene:start()
|
||||||
|
scene.super.start(self)
|
||||||
|
|
||||||
|
self.optionsMenu:addMenuItem("Main Menu", function() Noble.transition(Menu) end)
|
||||||
|
Noble.showFPS = false
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene:enter()
|
||||||
|
scene.super.enter(self)
|
||||||
|
scene.cards = {
|
||||||
|
DroneCard(0, 0, Drones[1]),
|
||||||
|
DroneCard(0, 0, Drones[2]),
|
||||||
|
DroneCard(0, 0, Drones[3]),
|
||||||
|
DroneCard(0, 0, Drones[4]),
|
||||||
|
}
|
||||||
|
scene.paginator = PageSprite(200, 207)
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene:update()
|
||||||
|
scene.super.update(self)
|
||||||
|
if scene.cards == nil then
|
||||||
|
print("scene.cards is nil")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
elapsedTime = elapsedTime + 1 / playdate.display.getRefreshRate()
|
||||||
|
|
||||||
|
local dy = 2 * math.sin(20 * elapsedTime)
|
||||||
|
|
||||||
|
local speed = 40
|
||||||
|
if math.abs(scene.targetX - scene.currentX) < speed then
|
||||||
|
scene.currentX = scene.targetX
|
||||||
|
else
|
||||||
|
scene.currentX = scene.currentX + speed * ((scene.targetX > scene.currentX) and 1 or -1)
|
||||||
|
end
|
||||||
|
|
||||||
|
local x = 0
|
||||||
|
for i = 1, 4 do
|
||||||
|
x = 29 + (339 + 16) * (i - 1)
|
||||||
|
scene.cards[i]:moveTo(x + scene.currentX, 25)
|
||||||
|
end
|
||||||
|
|
||||||
|
if Drones[scene.menuIndex].locked == false then
|
||||||
|
self.aKey:draw(315, 207 + dy)
|
||||||
|
Noble.Text.draw("Assemble", 333, 210, Noble.Text.ALIGN_LEFT, false, fontMed)
|
||||||
|
end
|
||||||
|
|
||||||
|
scene.paginator:moveTo(200, 207)
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene:exit()
|
||||||
|
scene.super.exit(self)
|
||||||
|
for i = 1, 4 do
|
||||||
|
scene.cards[i]:remove()
|
||||||
|
end
|
||||||
|
Noble.showFPS = false
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene:finish()
|
||||||
|
scene.super.finish(self)
|
||||||
|
playdate.display.setScale(1)
|
||||||
|
end
|
@ -48,7 +48,7 @@ function scene:setValues()
|
|||||||
scene.balebaSpawner = playdate.timer.new(10000)
|
scene.balebaSpawner = playdate.timer.new(10000)
|
||||||
scene.balebaSpawner.repeats = true
|
scene.balebaSpawner.repeats = true
|
||||||
|
|
||||||
scene.levelAudio = playdate.sound.fileplayer.new("assets/audio/war")
|
scene.levelAudio = playdate.sound.fileplayer.new("assets/audio/game")
|
||||||
scene.levelAudio:setVolume(0.7)
|
scene.levelAudio:setVolume(0.7)
|
||||||
scene.helloAudio = playdate.sound.fileplayer.new("assets/audio/hello")
|
scene.helloAudio = playdate.sound.fileplayer.new("assets/audio/hello")
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ function scene:start()
|
|||||||
playdate.ui.crankIndicator:draw() -- not sure why this is not working
|
playdate.ui.crankIndicator:draw() -- not sure why this is not working
|
||||||
|
|
||||||
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:spawnBaleba()
|
function scene:spawnBaleba()
|
||||||
|
@ -16,6 +16,11 @@ function scene:setValues()
|
|||||||
self.menuYFrom = -50
|
self.menuYFrom = -50
|
||||||
self.menuY = 15
|
self.menuY = 15
|
||||||
self.menuYTo = 240
|
self.menuYTo = 240
|
||||||
|
|
||||||
|
scene.musicEnabled = Noble.Settings.get("music")
|
||||||
|
|
||||||
|
scene.levelAudio = playdate.sound.fileplayer.new("assets/audio/menu")
|
||||||
|
scene.levelAudio:setVolume(0.7)
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene:init()
|
function scene:init()
|
||||||
@ -66,6 +71,10 @@ end
|
|||||||
function scene:enter()
|
function scene:enter()
|
||||||
scene.super.enter(self)
|
scene.super.enter(self)
|
||||||
self.sequence = Sequence.new():from(self.menuYFrom):to(self.menuY, 1.5, Ease.outBounce):start()
|
self.sequence = Sequence.new():from(self.menuYFrom):to(self.menuY, 1.5, Ease.outBounce):start()
|
||||||
|
|
||||||
|
if scene.musicEnabled then
|
||||||
|
scene.levelAudio:play(0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene:start()
|
function scene:start()
|
||||||
@ -97,12 +106,13 @@ end
|
|||||||
|
|
||||||
function scene:exit()
|
function scene:exit()
|
||||||
scene.super.exit(self)
|
scene.super.exit(self)
|
||||||
|
scene.levelAudio:stop()
|
||||||
self.sequence = Sequence.new():from(self.menuY):to(self.menuYTo, 0.5, Ease.inSine)
|
self.sequence = Sequence.new():from(self.menuY):to(self.menuYTo, 0.5, Ease.inSine)
|
||||||
self.sequence:start();
|
self.sequence:start()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene:setupMenu(__menu)
|
function scene:setupMenu(__menu)
|
||||||
__menu:addItem("Start", function() Noble.transition(DroneSelection, nil, Noble.Transition.DipToWhite) end)
|
__menu:addItem("Start", function() Noble.transition(DroneCardSelector, nil, Noble.Transition.DipToWhite) end)
|
||||||
__menu:addItem("Tutorial", function() return end)
|
__menu:addItem("Tutorial", function() return end)
|
||||||
__menu:addItem("Credits", function() return end)
|
__menu:addItem("Credits", function() return end)
|
||||||
__menu:select("Start")
|
__menu:select("Start")
|
||||||
|
13
source/scripts/DroneCard.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
local pd <const> = playdate
|
||||||
|
local gfx <const> = Graphics
|
||||||
|
|
||||||
|
local fontSimple = Graphics.font.new('assets/fonts/peridot_7')
|
||||||
|
|
||||||
|
class('DroneCard').extends(gfx.sprite)
|
||||||
|
|
||||||
|
function DroneCard:init(x, y, drone)
|
||||||
|
self:setImage(gfx.image.new('assets/images/card_' .. drone.id .. '.png'))
|
||||||
|
self:setCenter(0, 0)
|
||||||
|
self:moveTo(x, y)
|
||||||
|
self:add()
|
||||||
|
end
|
22
source/scripts/pageSprite.lua
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
PageSprite = {}
|
||||||
|
class('PageSprite').extends(NobleSprite)
|
||||||
|
|
||||||
|
function PageSprite:init(x, y)
|
||||||
|
Baleba.super.init(self, "assets/sprites/pages", true)
|
||||||
|
self.animation:addState("1", 1, 1)
|
||||||
|
self.animation:addState("2", 2, 2)
|
||||||
|
self.animation:addState("3", 3, 3)
|
||||||
|
self.animation:addState("4", 4, 4)
|
||||||
|
self.animation:setState("1")
|
||||||
|
|
||||||
|
-- self:setCenter(0, 0)
|
||||||
|
|
||||||
|
self:setSize(64, 64)
|
||||||
|
|
||||||
|
self:moveTo(x, y)
|
||||||
|
self:add()
|
||||||
|
end
|
||||||
|
|
||||||
|
function PageSprite:set(page)
|
||||||
|
self.animation:setState(page .. "")
|
||||||
|
end
|