2017-07-05 07:22:58 -07:00
|
|
|
require "lib/keys"
|
|
|
|
require "lib/functions"
|
2017-08-10 14:59:43 -07:00
|
|
|
require "levels/gamestates"
|
2017-07-05 07:11:51 -07:00
|
|
|
|
|
|
|
function love.load()
|
|
|
|
-- Create a table and grab the screen width/height
|
|
|
|
screen = {}
|
|
|
|
screen.width = love.graphics.getWidth()
|
|
|
|
screen.height = love.graphics.getHeight()
|
2017-07-25 21:31:57 -07:00
|
|
|
|
|
|
|
-- Create a table to hold all actors
|
|
|
|
actors = {}
|
2017-07-05 07:11:51 -07:00
|
|
|
|
|
|
|
-- Create a table to hold all the player data
|
2017-07-25 21:31:57 -07:00
|
|
|
actors.player = create_object(screen.width /2, screen.height - 50, 30, 5, 500)
|
2017-07-22 15:45:12 -07:00
|
|
|
-- Create a table to hold ball data
|
2017-07-25 22:19:56 -07:00
|
|
|
actors.ball = create_object(screen.width /2, screen.height /2, 5, 5, 600)
|
|
|
|
actors.ball.x_speed = (-actors.ball.speed /2)
|
|
|
|
actors.ball.y_speed = (-actors.ball.speed /2)
|
|
|
|
actors.ball.score = 0
|
2017-07-22 15:45:12 -07:00
|
|
|
|
2017-08-10 10:59:40 -07:00
|
|
|
-- Timer vars (see keys.lua for loaded timer vars)
|
2017-07-25 22:19:56 -07:00
|
|
|
actors.start = love.timer.getTime()
|
2017-08-10 10:16:18 -07:00
|
|
|
actors.end_timer = 0
|
2017-08-10 14:59:43 -07:00
|
|
|
|
|
|
|
-- Set the starting screen
|
|
|
|
gamestate = {}
|
|
|
|
gamestate.draw = Gamestates.title_draw
|
|
|
|
gamestate.update = Gamestates.title_update
|
2017-07-05 07:11:51 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
function love.update(dt)
|
2017-08-10 14:59:43 -07:00
|
|
|
gamestate.update(dt)
|
2017-07-05 07:11:51 -07:00
|
|
|
end
|
2017-07-16 13:15:47 -07:00
|
|
|
|
2017-07-05 07:11:51 -07:00
|
|
|
function love.draw()
|
2017-08-10 14:59:43 -07:00
|
|
|
gamestate.draw()
|
2017-07-05 07:11:51 -07:00
|
|
|
end
|