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.
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
On another note, this issue came up more than once, so i'd be interested to know what kind of code editor (or system locale) messes with the minus sign.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
zorg wrote:On another note, this issue came up more than once, so i'd be interested to know what kind of code editor (or system locale) messes with the minus sign.
Probably some typesetting software did that and code was copypasted from book.