diff --git a/love/mike/TODO b/love/mike/TODO index 49242f5..6f3e004 100644 --- a/love/mike/TODO +++ b/love/mike/TODO @@ -19,3 +19,10 @@ Seperate out (or add debug mode) to the print_table function so saving is a sepe make keys.lua more simple by turning more of the code into functions and stuff it in functions.lua + +Add continue after pressing Q during gameplay. (timer should keep going) +Reset gamestate when player starts a new game. +move save and load to the title screen +make the title screen better looking +change the title screen to be a selection instead of just pressing keys +remove "q" from qutting the gameplay. Change it to "esc" and have it be a menu instead of insta-quit. diff --git a/love/mike/levels/gamestates.lua b/love/mike/levels/gamestates.lua index 5b1e383..df6aabf 100644 --- a/love/mike/levels/gamestates.lua +++ b/love/mike/levels/gamestates.lua @@ -3,7 +3,7 @@ Gamestates = {} -- Title screen function Gamestates.title_draw() love.graphics.setColor(255,0,0) - love.graphics.print(string.format("Press space to start!"), screen.width/2, screen.height/2) + love.graphics.print(string.format("Press space to start!\n Or 'q' to exit."), screen.width/2, screen.height/2) end function Gamestates.title_update() @@ -11,6 +11,10 @@ function Gamestates.title_update() gamestate.draw = Gamestates.main_draw gamestate.update = Gamestates.main_update end + + if love.keyboard.isDown(QUIT_KEY) then + love.event.quit() + end end -- Main game loop diff --git a/love/mike/lib/keys.lua b/love/mike/lib/keys.lua index bd8bc9b..48fea2f 100644 --- a/love/mike/lib/keys.lua +++ b/love/mike/lib/keys.lua @@ -9,11 +9,9 @@ MOVE_LEFT = "left" SAVE_FILE = "testing.lua" function love.keyreleased(key) - if key == QUIT_KEY then - love.event.quit() -- save - elseif key == SAVE_KEY then + if key == SAVE_KEY then love.filesystem.write(SAVE_FILE, GameState.save(actors, "actors")) -- Load @@ -43,6 +41,12 @@ function check_keys(object, screen, dt) newObject.height = object.height newObject.speed = object.speed + if love.keyboard.isDown(QUIT_KEY) then + love.timer.sleep( 1 ) + gamestate.draw = Gamestates.title_draw + gamestate.update = Gamestates.title_update + end + if love.keyboard.isDown(MOVE_RIGHT) then newObject.x = newObject.x + half_speed(newObject.speed * dt) end @@ -54,4 +58,5 @@ function check_keys(object, screen, dt) else return object end + end