redesign music and drone selection
This commit is contained in:
@@ -8,6 +8,9 @@ local fontMed = Graphics.font.new('assets/fonts/onyx_9')
|
||||
local allButtons = { "A", "B", "DOWN", "LEFT", "RIGHT", "UP" }
|
||||
|
||||
function scene:popCode(button)
|
||||
if #scene.code == 0 then
|
||||
return
|
||||
end
|
||||
scene.menuConfirmSound:stop()
|
||||
if scene.tickTimer.paused then
|
||||
scene.droneParts = scene:loadDrone(1, #scene.code)
|
||||
@@ -35,7 +38,14 @@ function scene:popCode(button)
|
||||
end
|
||||
|
||||
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,
|
||||
downButtonDown = function() scene:popCode("DOWN") end,
|
||||
leftButtonDown = function() scene:popCode("LEFT") end,
|
||||
@@ -95,6 +105,11 @@ function scene:setValues()
|
||||
|
||||
scene.menuConfirmSound = playdate.sound.fileplayer.new("assets/audio/confirm")
|
||||
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
|
||||
|
||||
function scene:init()
|
||||
@@ -120,11 +135,19 @@ function scene:start()
|
||||
scene.super.start(self)
|
||||
|
||||
self.optionsMenu:addMenuItem("Main Menu", function() Noble.transition(Menu) end)
|
||||
Noble.showFPS = true
|
||||
Noble.showFPS = false
|
||||
end
|
||||
|
||||
function scene:enter()
|
||||
scene.super.enter(self)
|
||||
|
||||
scene.buttonTimeout = 100
|
||||
|
||||
Noble.Input.setHandler(scene.inputHandler)
|
||||
|
||||
if scene.musicEnabled then
|
||||
scene.levelAudio:play(0)
|
||||
end
|
||||
end
|
||||
|
||||
function round(number)
|
||||
@@ -155,13 +178,6 @@ function scene:update()
|
||||
yEnd = 100,
|
||||
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)
|
||||
Noble.Text.draw("Start Mission", 218, 175, Noble.Text.ALIGN_LEFT, false, fontMed)
|
||||
self.progressBar:remove()
|
||||
@@ -210,7 +226,7 @@ end
|
||||
|
||||
function scene:exit()
|
||||
scene.super.exit(self)
|
||||
|
||||
scene.levelAudio:stop()
|
||||
Noble.showFPS = false
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user