39 lines
994 B
Lua
39 lines
994 B
Lua
require "lib/keys"
|
|
require "lib/functions"
|
|
require "levels/gamestates"
|
|
|
|
function love.load()
|
|
-- Create a table and grab the screen width/height
|
|
screen = {}
|
|
screen.width = love.graphics.getWidth()
|
|
screen.height = love.graphics.getHeight()
|
|
|
|
-- Create a table to hold all actors
|
|
actors = {}
|
|
|
|
-- Create a table to hold all the player data
|
|
actors.player = create_object(screen.width /2, screen.height - 50, 30, 5, 500)
|
|
-- Create a table to hold ball data
|
|
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
|
|
|
|
-- Timer vars (see keys.lua for loaded timer vars)
|
|
actors.start = love.timer.getTime()
|
|
actors.end_timer = 0
|
|
|
|
-- Set the starting screen
|
|
gamestate = {}
|
|
gamestate.draw = Gamestates.title_draw
|
|
gamestate.update = Gamestates.title_update
|
|
end
|
|
|
|
function love.update(dt)
|
|
gamestate.update(dt)
|
|
end
|
|
|
|
function love.draw()
|
|
gamestate.draw()
|
|
end
|