summaryrefslogtreecommitdiffhomepage
path: root/main.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-27 13:11:11 +0200
committerAki <nthirtyone@gmail.com>2016-05-27 13:11:11 +0200
commit8adcd1d14ee076d7a2db6303d0b5b938977d356b (patch)
treea24b6063d3dab3584cfddab1c984e1418b31cd7d /main.lua
parent6672ea6ee588452fbbbd6996af160e4059643d16 (diff)
downloadroflnauts-8adcd1d14ee076d7a2db6303d0b5b938977d356b.zip
roflnauts-8adcd1d14ee076d7a2db6303d0b5b938977d356b.tar.gz
roflnauts-8adcd1d14ee076d7a2db6303d0b5b938977d356b.tar.bz2
More controllers updates
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua37
1 files changed, 21 insertions, 16 deletions
diff --git a/main.lua b/main.lua
index b5c8840..05a21f4 100644
--- a/main.lua
+++ b/main.lua
@@ -3,7 +3,7 @@
require "world"
require "camera"
---require "menu"
+-- require "menu"
require "controller"
-- Temporary debug
@@ -26,14 +26,17 @@ function love.load ()
w = World:new("default", "leon", "lonestar", third, fourth)
-- Controllers
- cont1 = Controller:new()
- cont2 = Controller:new(nil, "a", "d", "w", "s", "g", "h")
- w.Nauts[1]:assignController(cont1)
- w.Nauts[2]:assignController(cont2)
+ Controllers = {}
+ table.insert(Controllers, Controller:new())
+ table.insert(Controllers, Controller:new(nil, "a", "d", "w", "s", "g", "h"))
+ w.Nauts[1]:assignController(Controllers[1])
+ w.Nauts[2]:assignController(Controllers[2])
-- Menu bijaczes
- --m = Menu:new()
- --m:newSelector()
+ -- m = Menu:new()
+ -- m:newSelector()
+ -- m:newSelector()
+ -- m.selectors[2]:setPosition(33,33)
end
-- Update
@@ -43,14 +46,15 @@ end
-- KeyPressed
function love.keypressed (key)
- w:keypressed(key)
- cont1:keypressed(key)
- cont2:keypressed(key)
- -- Switch hitbox display on/off
+ -- Controllers
+ for _,controller in pairs(Controllers) do
+ controller:keypressed(key)
+ end
+ -- Misc global input
if key == "x" then
debug = not debug
end
- if key == "escape" then
+ if key == "escape" or key == "f1" then
love.event.quit()
end
if key == "f5" and debug then
@@ -64,15 +68,16 @@ end
-- KeyReleased
function love.keyreleased(key)
- w:keyreleased(key)
- cont1:keyreleased(key)
- cont2:keyreleased(key)
+ -- Controllers
+ for _,controller in pairs(Controllers) do
+ controller:keyreleased(key)
+ end
end
-- Draw
function love.draw ()
w:draw()
- --m.selectors[1]:draw()
+ -- m:draw()
if debug then
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
end