summaryrefslogtreecommitdiffhomepage
path: root/main.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-26 15:33:46 +0200
committerAki <nthirtyone@gmail.com>2016-05-26 15:33:46 +0200
commit2252cd12fdceb2799e38bc3cb375c3bbd9be5e7a (patch)
tree52f2e18d738dea5c3f220535981d350d83d54def /main.lua
parenteb8c23fb8fff5c8faefa84e6f166bc0f3234a1ec (diff)
downloadroflnauts-2252cd12fdceb2799e38bc3cb375c3bbd9be5e7a.zip
roflnauts-2252cd12fdceb2799e38bc3cb375c3bbd9be5e7a.tar.gz
roflnauts-2252cd12fdceb2799e38bc3cb375c3bbd9be5e7a.tar.bz2
Controller changes
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua33
1 files changed, 23 insertions, 10 deletions
diff --git a/main.lua b/main.lua
index 8a59bba..71ebe06 100644
--- a/main.lua
+++ b/main.lua
@@ -2,15 +2,13 @@
-- WHOLE CODE HAS FLAG OF "need a cleanup"
require "world"
-require "ground"
-require "player"
require "camera"
-require "cloud"
-require "effect"
+--require "menu"
+require "controller"
-- Temporary debug
debug = false
-third = "clunk"
+third = nil --"clunk"
fourth = nil --"yuri"
-- Load
@@ -18,15 +16,21 @@ function love.load ()
-- Graphics
love.graphics.setBackgroundColor(189, 95, 93)
love.graphics.setDefaultFilter("nearest", "nearest")
-
+
-- Font
Font = love.graphics.newImageFont("assets/font2.png", " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-,!:()[]{}<>", -1)
Font:setLineHeight(1)
love.graphics.setFont(Font)
-
+
-- ZU WARUDO!
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)
+
-- Temporary settings for second player
w.Nauts[2].key_left = "a"
w.Nauts[2].key_right = "d"
@@ -34,7 +38,7 @@ function love.load ()
w.Nauts[2].key_down = "s"
w.Nauts[2].key_jump = "g"
w.Nauts[2].key_hit = "f"
-
+
-- Temporary settings for third player
if third ~= nil then
w.Nauts[3].key_left = "kp4"
@@ -44,7 +48,7 @@ function love.load ()
w.Nauts[3].key_jump = "kp2"
w.Nauts[3].key_hit = "kp3"
end
-
+
-- Temporary settings for fourth player
if fourth ~= nil then
w.Nauts[4].key_left = "b"
@@ -54,6 +58,10 @@ function love.load ()
w.Nauts[4].key_jump = "k"
w.Nauts[4].key_hit = "l"
end
+
+ -- Menu bijaczes
+ --m = Menu:new()
+ --m:newSelector()
end
-- Update
@@ -64,6 +72,8 @@ end
-- KeyPressed
function love.keypressed (key)
w:keypressed(key)
+ cont1:keypressed(key)
+ cont2:keypressed(key)
-- Switch hitbox display on/off
if key == "x" then
debug = not debug
@@ -81,11 +91,14 @@ end
-- KeyReleased
function love.keyreleased(key)
w:keyreleased(key)
+ cont1:keyreleased(key)
+ cont2:keyreleased(key)
end
-- Draw
function love.draw ()
w:draw()
+ --m.selectors[1]:draw()
if debug then
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
end