diff options
author | Aki <nthirtyone@gmail.com> | 2016-07-30 16:16:50 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-07-30 16:16:50 +0200 |
commit | 1657ac4ddb5e223dd492d13d13fb114c232b7271 (patch) | |
tree | 42dfff8e1daa4a18541898ad082df0d3a2d06f50 | |
parent | 3557d20ea1e6de42b756e76f3a21818753cf1c50 (diff) | |
download | roflnauts-1657ac4ddb5e223dd492d13d13fb114c232b7271.zip roflnauts-1657ac4ddb5e223dd492d13d13fb114c232b7271.tar.gz roflnauts-1657ac4ddb5e223dd492d13d13fb114c232b7271.tar.bz2 |
Selector assing on attack only
-rw-r--r-- | menu.lua | 22 | ||||
-rw-r--r-- | selector.lua | 1 |
2 files changed, 16 insertions, 7 deletions
@@ -47,7 +47,7 @@ function Menu:newSelector() local n = #self.selectors - 1 table.insert(self.selectors, selector) local x = (w-76)/2+n*44 - local y = h/2-16 + local y = h/2-8 selector:setPosition(x, y) end @@ -106,12 +106,18 @@ end -- Draw function Menu:draw() + -- locals + local w, h = love.graphics.getWidth()/self.scale, love.graphics.getHeight()/self.scale + local scale = self.scale + -- map selection + love.graphics.setFont(Font) + love.graphics.printf("Map: " .. self.maplist[self.map], (w/2)*scale, (h/2-22)*scale, 150, "center", 0, scale, scale, 75, 4) + -- character selection for _,selector in pairs(self:getSelectorsAll()) do selector:draw() end + -- countdown local countdown, _ = math.modf(self.countdown) - local w, h = love.graphics.getWidth()/self.scale, love.graphics.getHeight()/self.scale - local scale = self.scale if self.countdown < Menu.countdown then -- Menu.countdown is initial love.graphics.setFont(Bold) love.graphics.print(countdown,(w/2-6.5)*self.scale,(h/2+30)*self.scale,0,self.scale,self.scale) @@ -122,6 +128,7 @@ function Menu:draw() local angle = self:getBounce(2) local dy = self:getBounce()*4 love.graphics.printf("ROFLNAUTS2",(w/2)*scale,(32+dy)*scale,336,"center",(angle*5)*math.pi/180,scale,scale,168,12) + -- footer love.graphics.setFont(Font) love.graphics.printf("Use W,S,A,D,G,H or Arrows,Enter,Rshift or Gamepad\n\nA game by Awesomenauts Community\nSeltzy, ParaDoX, MilkingChicken, Burningdillo, Bronkey, Aki\nBased on a game by Jan Willem Nijman, Paul Veer and Bits_Beats XOXO", (w/2)*scale, (h-42)*scale, 336, "center", 0, scale, scale, 168, 4) end @@ -179,10 +186,11 @@ function Menu:assignController(controller) end function Menu:controllerPressed(control, controller) - local selector = self:getSelectorsInactive()[1] - if selector ~= nil then - selector:assignController(controller) - selector:controllerPressed(control) + if control == "attack" then + local selector = self:getSelectorsInactive()[1] + if selector ~= nil then + selector:assignController(controller) + end end end diff --git a/selector.lua b/selector.lua index c8740db..01d7fcf 100644 --- a/selector.lua +++ b/selector.lua @@ -49,6 +49,7 @@ end function Selector:assignController(controller) controller:setParent(self) self.controller = controller + self.naut = 2 end function Selector:getController() if self.controller ~= nil then |