31 lines
827 B
Lua
31 lines
827 B
Lua
require "lib/keys"
|
|
require "lib/functions"
|
|
|
|
function love.load()
|
|
saveFile = "test.lua"
|
|
|
|
-- 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 the player data
|
|
player = create_object(screen.width /2, screen.height - 50, 30, 5, 500)
|
|
-- Create a table to hold ball data
|
|
ball = create_object(screen.width /2, screen.height /2, 1, 1, 600)
|
|
ball.x_speed = (ball.speed /2)
|
|
ball.y_speed = (ball.speed /2)
|
|
|
|
|
|
end
|
|
|
|
function love.update(dt)
|
|
player = check_keys(player, screen, dt)
|
|
ball = ball_bounce(player, ball, dt)
|
|
end
|
|
|
|
function love.draw()
|
|
love.graphics.rectangle("line", player.x, player.y, player.width, player.height)
|
|
love.graphics.rectangle("line", ball.x, ball.y, ball.width, ball.height)
|
|
end
|