summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-07-15 01:21:01 +0200
committerAki <nthirtyone@gmail.com>2017-07-15 01:21:01 +0200
commit1aa2ddfd920899e61295d876f3433dcab6dd6ed8 (patch)
treef891682db0cb7f43c81ae6aa1990748163d4bd08
parent8226ffafa0d24a0c6e80d5411ab8dea69dc29094 (diff)
downloadroflnauts-1aa2ddfd920899e61295d876f3433dcab6dd6ed8.zip
roflnauts-1aa2ddfd920899e61295d876f3433dcab6dd6ed8.tar.gz
roflnauts-1aa2ddfd920899e61295d876f3433dcab6dd6ed8.tar.bz2
Win screen is now handled by Scene
Issue with MusicPlayer calls in Scene constructor (not solved)
-rw-r--r--not/SceneManager.lua5
-rw-r--r--not/World.lua24
2 files changed, 7 insertions, 22 deletions
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