require 'player'
function love.load()
mediumFont = love.graphics.newFont(20)
bg_color()
end
function love.update(dt)
if love.keyboard.isDown("right") then
player_x = player_x + (speed * dt)
elseif love.keyboard.isDown("left") then
player_x = player_x - (speed * dt)
end
if love.keyboard.isDown("up") then
player_y = player_y - (speed * dt)
elseif love.keyboard.isDown("down") then
player_y = player_y + (speed * dt)
end
end
function love.draw()
love.draw(player_mob, player_x, player_y)
love.graphics.setFont(mediumFont)
setColor("black")
love.graphics.print("Start Game", 5, 5)
resetColor()
end
function bg_color()
love.graphics.setBackgroundColor(187, 255, 129)
end
function setColor(color)
if color == "black" then
love.graphics.setColor(0, 0, 0)
end
end
function resetColor()
love.graphics.setColor(255, 255, 255)
end
You are causing a recursion in love.draw(), i.e. love.draw is calling itself over and over again... until there is no memory left. You are looking for the love.graphics.draw(...) funtion.