summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-06-27 15:06:27 +0200
committerAki <nthirtyone@gmail.com>2016-06-27 15:06:27 +0200
commit2f96ef6774585691ce6a9b83449f36a2681403b9 (patch)
tree401d22efe021064bd386754711c789b2a132eb0e
parent71db337cb1928080f78b6b14646cce3731ecff5a (diff)
downloadroflnauts-2f96ef6774585691ce6a9b83449f36a2681403b9.zip
roflnauts-2f96ef6774585691ce6a9b83449f36a2681403b9.tar.gz
roflnauts-2f96ef6774585691ce6a9b83449f36a2681403b9.tar.bz2
More bounciness!
-rw-r--r--player.lua2
-rw-r--r--world.lua20
2 files changed, 14 insertions, 8 deletions
diff --git a/player.lua b/player.lua
index 70446b4..48d7843 100644
--- a/player.lua
+++ b/player.lua
@@ -19,7 +19,7 @@ Player = {
world = nil, -- game world
-- Combat
combo = 1,
- lives = 3,
+ lives = 0,
spawntimer = 0,
alive = true,
punchcd = 0,
diff --git a/world.lua b/world.lua
index 1e46c06..8da0d6b 100644
--- a/world.lua
+++ b/world.lua
@@ -29,8 +29,7 @@ World = {
-- Gameplay status
lastNaut = false,
-- "WINNER"
- win_angle = 0,
- win_dir = 1
+ win_move = 0
}
-- Constructor of `World` ZA WARUDO!
@@ -238,13 +237,17 @@ function World:update(dt)
end
end
-- Bounce `winner`
- if self.lastNaut then
- if self.win_angle > 5 then self.win_dir = -1
- elseif self.win_angle < -5 then self.win_dir = 1 end
- self.win_angle = self.win_angle + dt * self.win_dir * 16
+ self.win_move = self.win_move + dt
+ if self.win_move > 2 then
+ self.win_move = self.win_move - 2
end
end
+function World:getBounce(f)
+ local f = f or 1
+ return math.sin(self.win_move*f*math.pi)
+end
+
-- Draw
function World:draw()
-- Camera stuff
@@ -318,9 +321,12 @@ function World:draw()
-- 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,(40)*scale,336,"center",self.win_angle*math.pi/180,scale,scale,168,12)
+ 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