dt is a nil value?
Posted: Fri Jan 01, 2016 1:09 am
im trying to make a player movement system, however it keeps telling me that dt is a nil value... help?
function player.move(dt)
local x, y = nil, nil
if love.keyboard.isDown("up") then
y = player.y - player.speed * dt
elseif love.keyboard.isDown("down") then
y = player.y + player.speed * dt
end
if love.keyboard.isDown("left") then
x = player.x - player.speed * dt
elseif love.keyboard.isDown("right") then
x = player.x + player.speed * dt
end
end
function player.move(dt)
local x, y = nil, nil
if love.keyboard.isDown("up") then
y = player.y - player.speed * dt
elseif love.keyboard.isDown("down") then
y = player.y + player.speed * dt
end
if love.keyboard.isDown("left") then
x = player.x - player.speed * dt
elseif love.keyboard.isDown("right") then
x = player.x + player.speed * dt
end
end