tank
This commit is contained in:
@@ -28,6 +28,8 @@ function scene:setValues()
|
||||
scene.t = playdate.timer.new(10000)
|
||||
scene.t.repeats = true
|
||||
|
||||
scene.tankTimer = playdate.timer.new(1000)
|
||||
|
||||
scene.fp = playdate.sound.fileplayer.new( "assets/audio/war" )
|
||||
scene.fp:setVolume(0.7)
|
||||
scene.hello = playdate.sound.fileplayer.new( "assets/audio/hello" )
|
||||
@@ -68,7 +70,7 @@ function scene:enter()
|
||||
end
|
||||
|
||||
local k = #scene.balebas+1
|
||||
scene.balebas[k] = scene:spawnBaleba()
|
||||
--scene.balebas[k] = scene:spawnBaleba()
|
||||
end
|
||||
|
||||
for i=1, 3 do
|
||||
@@ -80,6 +82,11 @@ function scene:enter()
|
||||
if musicEnabled then
|
||||
scene.fp:play(0)
|
||||
end
|
||||
|
||||
scene.tankTimer.timerEndedCallback = function()
|
||||
scene.tank = Tank(550, 190, scene.player, scene.ground)
|
||||
scene.tank:add()
|
||||
end
|
||||
end
|
||||
|
||||
function scene:update()
|
||||
@@ -90,15 +97,13 @@ function scene:update()
|
||||
return
|
||||
end
|
||||
|
||||
if scene.player.isDead() then
|
||||
if not scene.telemLostSoundPlayed then
|
||||
scene.telemLostSound:play(1)
|
||||
scene.telemLostSoundPlayed = true
|
||||
screenShake(500, 5)
|
||||
end
|
||||
|
||||
scene:destroyPlayer()
|
||||
local et = playdate.timer.new(2000)
|
||||
if scene.player.isDead() and not scene.telemLostSoundPlayed then
|
||||
scene.telemLostSound:play(1)
|
||||
scene.telemLostSoundPlayed = true
|
||||
screenShake(500, 5)
|
||||
|
||||
|
||||
local et = playdate.timer.new(6000)
|
||||
et.timerEndedCallback = function()
|
||||
Noble.transition(Menu)
|
||||
end
|
||||
@@ -126,6 +131,9 @@ function scene:exit()
|
||||
scene.ground:remove()
|
||||
scene.ground = nil
|
||||
|
||||
scene.tank:remove()
|
||||
scene.ground = nil
|
||||
|
||||
for i=1, #scene.balebas do
|
||||
scene.balebas[i]:destroy()
|
||||
scene.balebas[i] = nil
|
||||
@@ -139,6 +147,9 @@ function scene:exit()
|
||||
scene.t:remove()
|
||||
scene.t = nil
|
||||
|
||||
scene.tankTimer:remove()
|
||||
scene.tankTimer = nil
|
||||
|
||||
|
||||
Noble.showFPS = false
|
||||
end
|
||||
|
Reference in New Issue
Block a user