From 1aa2ddfd920899e61295d876f3433dcab6dd6ed8 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 15 Jul 2017 01:21:01 +0200 Subject: Win screen is now handled by Scene Issue with MusicPlayer calls in Scene constructor (not solved) --- not/SceneManager.lua | 5 +++++ not/World.lua | 24 ++---------------------- 2 files changed, 7 insertions(+), 22 deletions(-) (limited to 'not') diff --git a/not/SceneManager.lua b/not/SceneManager.lua index c9a8e20..c076448 100644 --- a/not/SceneManager.lua +++ b/not/SceneManager.lua @@ -18,6 +18,11 @@ function SceneManager:addScene (scene) return scene end +-- Not nice, not nice. +function SceneManager:removeTopScene () + table.remove(self.scenes, #self.scenes) +end + function SceneManager:getAllScenes () return self.scenes end diff --git a/not/World.lua b/not/World.lua index 65ca59e..29c46cc 100644 --- a/not/World.lua +++ b/not/World.lua @@ -16,7 +16,6 @@ World.clouds_delay = 5 World.map =--[[config.maps.*]]nil World.background =--[[image?]]nil World.lastNaut = false -World.win_move = 0 -- "WINNER" require "not.Platform" require "not.Player" @@ -193,18 +192,15 @@ function World:onNautKilled (naut) self:createRay(naut) local nauts = self:getNautsPlayable() if self.lastNaut then + sceneManager:removeTopScene() sceneManager:changeScene(Menu()) elseif #nauts < 2 then self.lastNaut = true naut:playSound(5, true) + sceneManager:addScene(Menu("win")) end end -function World:getBounce (f) - local f = f or 1 - return math.sin(self.win_move*f*math.pi) -end - -- LÖVE2D callbacks -- Update ZU WARUDO function World:update (dt) @@ -250,11 +246,6 @@ function World:update (dt) table.remove(self.Rays, _) end end - -- Bounce `winner` - self.win_move = self.win_move + dt - if self.win_move > 2 then - self.win_move = self.win_move - 2 - end end -- Draw function World:draw () @@ -333,17 +324,6 @@ function World:draw () if _ < 3 then y, e = h-33, 0 end naut:drawHUD(1+(_%2)*(w-34), y, scale, e) end - - -- Draw winner - if self.lastNaut then - local w, h = love.graphics.getWidth()/scale, love.graphics.getHeight()/scale - local angle = self:getBounce(2) - local dy = self:getBounce()*3 - love.graphics.setFont(Bold) - love.graphics.printf("WINNER",(w/2)*scale,(42+dy)*scale,336,"center",(angle*5)*math.pi/180,scale,scale,168,12) - love.graphics.setFont(Font) - love.graphics.printf("rofl, now kill yourself", w/2*scale, 18*scale, 160, "center", 0, scale, scale, 80, 3) - end end -- Box2D callbacks -- cgit v1.1