diff options
author | Aki <nthirtyone@gmail.com> | 2016-07-12 04:55:49 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-07-12 04:55:49 +0200 |
commit | 2ad829b2e6e56f918fdff2d3cffeec4138bc116a (patch) | |
tree | 3358a7e0401c98faea03f62bf9122eba00454f13 | |
parent | 1d6e9a2f1566fc8e1b6f819e83fd15a45d5cd961 (diff) | |
download | roflnauts-2ad829b2e6e56f918fdff2d3cffeec4138bc116a.zip roflnauts-2ad829b2e6e56f918fdff2d3cffeec4138bc116a.tar.gz roflnauts-2ad829b2e6e56f918fdff2d3cffeec4138bc116a.tar.bz2 |
Cleaning up
-rw-r--r-- | menu.lua | 19 | ||||
-rw-r--r-- | selector.lua | 4 |
2 files changed, 18 insertions, 5 deletions
@@ -16,7 +16,8 @@ Menu = { portrait_sprite = nil, portrait_sheet = require "portraits", scale = getScale(), - countdown = 6 + countdown = 6, + header_move = 0 } -- Constructor of `Menu` @@ -52,6 +53,11 @@ function Menu:newSelector() selector:setPosition(x, y) end +function Menu:getBounce(f) + local f = f or 1 + return math.sin(self.header_move*f*math.pi) +end + -- function Menu:draw() for _,selector in pairs(self.selectors) do @@ -70,9 +76,11 @@ function Menu:draw() end -- header love.graphics.setFont(Bold) - love.graphics.printf("ROFLNAUTS2",(w/2)*scale,(30)*scale,336,"center",0,scale/2,scale/2,168,12) + local angle = self:getBounce(2) + local dy = self:getBounce()*3 + love.graphics.printf("ROFLNAUTS2",(w/2)*scale,(42+dy)*scale,336,"center",(angle*5)*math.pi/180,scale/2,scale/2,168,12) love.graphics.setFont(Font) - love.graphics.printf("Game made by Awesomenauts Community\nAyy lmao\n0123456789\nBased on game by Vlambeer and so on...", (w/2)*scale, (h-30)*scale, 336, "center", 0, scale, scale, 168, 4) + love.graphics.printf("A game by Awesomenauts Community\nParaDoX, Burningdillo, MilkingChicken, Seltzy, Bronkey, Gnarlyman, Aki\nBased on a game by Jan Willem Nijman, Paul Veer and Bits_Beats XOXO", (w/2)*scale, (h-30)*scale, 336, "center", 0, scale, scale, 168, 4) end function Menu:update(dt) @@ -92,6 +100,11 @@ function Menu:update(dt) if state and self.countdown < 0 then self:startGame() end + -- Bounce header + self.header_move = self.header_move + dt + if self.header_move > 2 then + self.header_move = self.header_move - 2 + end end -- Speed up countdown diff --git a/selector.lua b/selector.lua index b3ab5c4..c8740db 100644 --- a/selector.lua +++ b/selector.lua @@ -34,13 +34,13 @@ function Selector:draw () local arrowl = self.parent.portrait_sheet.arrow_left local arrowr = self.parent.portrait_sheet.arrow_right if not self.state then - love.graphics.draw(sprite, p.normal, x*scale, y*scale, 0, 1*scale, 1*scale) + love.graphics.draw(sprite, p.normal, x*scale, y*scale, 0, scale, scale) if self.controller ~= nil then love.graphics.draw(sprite, arrowl, (x-2)* scale, (y+13)*scale, 0, scale, scale) love.graphics.draw(sprite, arrowr, (x+30)*scale, (y+13)*scale, 0, scale, scale) end else - love.graphics.draw(sprite, p.active, x*scale, y*scale, 0, 1*scale, 1*scale) + love.graphics.draw(sprite, p.active, x*scale, y*scale, 0, scale, scale) end if self.naut ~= 1 then love.graphics.printf(name, (x-6)*scale, (y+33)*scale, 44, "center", 0, scale, scale) |