diff --git a/level_state.lua b/level_state.lua index c1a6169..77b4398 100644 --- a/level_state.lua +++ b/level_state.lua @@ -113,8 +113,6 @@ function level_state:leave(bool) end function level_state:keypressed(key, unicode) - print('Somebody pressed ' .. key) - -- Ctrl + R restarts current level. if key == "r" and (love.keyboard.isDown("lctrl") @@ -137,9 +135,7 @@ end function level_state:keyreleased(key, unicode) - print('Somebody released ' .. key) - - for id, player in pairs(players) do + for id, player in pairs(players) do player:release(key) end end diff --git a/main.lua b/main.lua index 489f812..99a57c7 100644 --- a/main.lua +++ b/main.lua @@ -1,6 +1,5 @@ Gamestate = require 'hump.gamestate' require 'menu_state' -require 'level_state' require 'settings' -- Initialize game global variables and switch to menu state @@ -14,7 +13,7 @@ function love.load() love.physics.setMeter(PIXELS_PER_METER) Gamestate.registerEvents() - Gamestate.switch(level_state) + Gamestate.switch(menu_state) end function love.quit() diff --git a/menu_state.lua b/menu_state.lua index 4a4d3a3..46a47a6 100644 --- a/menu_state.lua +++ b/menu_state.lua @@ -1,8 +1,12 @@ Gamestate = require 'hump.gamestate' +require 'level_state' +require 'settings' menu_state = {} local font = love.graphics.newFont(18) +local titlefont = love.graphics.newFont(72) +local background = love.graphics.newImage('resources/graphics/sky.png') function menu_state:enter() love.graphics.setBackgroundColor(0, 0, 0, 0) @@ -10,10 +14,34 @@ end function menu_state:draw() + love.graphics.setColor(128, 128, 128, 255) + love.graphics.draw(background) + love.graphics.setColor(255,255,255,255) + love.graphics.setFont(titlefont) + + love.graphics.printf("FYSPLANE", 0, 100, love.window.getWidth(), "center") + love.graphics.setFont(font) - love.graphics.printf("WASD to move", 50, height-100, width, "left") - love.graphics.printf("Left mouse button to freeze, right mouse button to speed", width-250, height-100, 200, "right") + love.graphics.printf("PLAYER 1\ +\ +Turn CW: " .. KEYMAP[1]['cw'] .. "\ +Turn CCW: " .. KEYMAP[1]['ccw'] .. "\ +Shoot: " .. KEYMAP[1]['shoot'] .. "\ +Engine power up: " .. KEYMAP[1]['accelerate'] .. "\ +Engine power down: " .. KEYMAP[1]['decelerate'] .. "\ +", 40, 400, 400, "left") + + love.graphics.printf("PLAYER 2\ +\ +Turn CW: " .. KEYMAP[2]['cw'] .. "\ +Turn CCW: " .. KEYMAP[2]['ccw'] .. "\ +Shoot: " .. KEYMAP[2]['shoot'] .. "\ +Engine power up: " .. KEYMAP[2]['accelerate'] .. "\ +Engine power down: " .. KEYMAP[2]['decelerate'] .. "\ +", love.window.getWidth() - 40 - 400, 400, 400, "left") + + love.graphics.printf("PRESS ANY KEY TO BEGIN…", 0, 700, love.window.getWidth(), "center") end @@ -28,7 +56,7 @@ end function menu_state:keypressed(key, unicode) - + Gamestate.switch(level_state) end diff --git a/player.lua b/player.lua index b95c5cc..afaef49 100644 --- a/player.lua +++ b/player.lua @@ -48,7 +48,6 @@ Player = Class{ press = function(self, key) for action, keycode in pairs(self.keys) do if key == keycode then - print(self.name .. ' pressed ' .. action .. '!') if self.actions[action] and self.plane then self.actions[action](true) end @@ -59,7 +58,6 @@ Player = Class{ release = function(self, key) for action, keycode in pairs(self.keys) do if key == keycode then - print(self.name .. ' released ' .. action .. '!') if self.actions[action] and self.plane then self.actions[action](false) end diff --git a/settings.lua b/settings.lua index 8e9a379..ba3b33f 100644 --- a/settings.lua +++ b/settings.lua @@ -36,7 +36,7 @@ SCOREBOARD_MARGIN = 20 ENGINE_MAX = 500 INITIAL_PLANE_SPEED = 500 -INITIAL_ENGINE_SPEED = 300 +INITIAL_ENGINE_SPEED = ENGINE_MAX HIT_SCORE = 1 KILL_SCORE = 10