http://pastebin.com/vuDRxJXB
(I'm begginer on LÖVE)
Why my code doesn't work ?
Re: Why my code doesn't work ?
Please try to be more specific when asking for help, Tell us if you're getting an error, if so what error etc.
There's 2 problems in there, First, I got an error with your - sign, 2nd, You didn't end the love.update function.
Here's the working code:
Also this:
will make the player move incredibly slow, You may want to change that 1 to something higher.
There's 2 problems in there, First, I got an error with your - sign, 2nd, You didn't end the love.update function.
Here's the working code:
Code: Select all
function love.load()
p = {}
p.x = 300
p.y = 400
love.graphics.setBackgroundColor(182, 100, 0)
love.graphics.setColor(0, 0, 225)
end
function love.draw()
love.graphics.rectangle("fill", p.x, p.y, 100, 100)
end
function love.update(dt)
if love.keyboard.isDown('d') then
p.x = p.x + 1 * dt
elseif love.keyboard.isDown('a') then
p.x = p.x - 1 * dt
end
end
Code: Select all
p.x = p.x - 1 * dt
Who is online
Users browsing this forum: No registered users and 2 guests