Love for Lua Game Programming chapter 2 problem
Posted: Mon Sep 07, 2015 11:10 pm
I'm getting a problem with the following code... it doesn't like line 17 or 20 ( character.x = character.x – 1 * dt ) ( y-1)
Is this because the book was written a few years ago and things have moved on - if so is there a better book recommended to learn from please?
Sorry if this has been asked before but searching the forums didn't show anything up.
Is this because the book was written a few years ago and things have moved on - if so is there a better book recommended to learn from please?
Sorry if this has been asked before but searching the forums didn't show anything up.
Code: Select all
function love.load()
character = {}
character.x = 300
character.y = 400
love.graphics.setBackgroundColor(225, 153, 0)
love.graphics.setColor(0, 0, 225)
end
function love.draw()
love.graphics.rectangle("fill", character.x, character.y, 100, 100)
end
function love.update(dt)
if love.keyboard.isDown('d') then
character.x = character.x + 1 * dt
elseif love.keyboard.isDown('a') then
character.x = character.x – 1 * dt
end
if love.keyboard.isDown('w') then
character.y = character.y – 1 * dt
elseif love.keyboard.isDown('s') then
character.y = character.y + 1 * dt
end
end