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
dt is a nil value?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: dt is a nil value?
Are you calling "player.move()" inside love.update? if so are you calling it with dt as the argument? If you're not calling it within love.update you can put "local dt = love.timer.getDelta()" at the top of player.move.
Re: dt is a nil value?
@veethree
wont work still
wont work still
Re: dt is a nil value?
Without knowing more, its hard to help you... Could you post a .love so we can take a look?
Who is online
Users browsing this forum: Amazon [Bot] and 3 guests