[SOLVED]Simple Countdown doesnt work.
Posted: Fri Feb 12, 2016 8:56 am
Hello everybody, I'm new to Lua programming.
I'm trying to work on a simple countdown, but Love gives me an error:
--
Error
Syntax Error: main.lua:16: 'then' expected near '='
--
here is my simple code:
function love.load()
love.graphics.setBackgroundColor(255, 255, 255)
totalTime = 30
gameOver = false
end
function love.update(dt)
totalTime = totalTime - dt
if totalTime <= 0 then
gameOver = true
end
end
function love.draw()
if gameOver = true then
love.graphics.print("GAME OVER", 100, 100)
end
end
I don't get why does Love tells that the syntax is wrong :/
I'm trying to work on a simple countdown, but Love gives me an error:
--
Error
Syntax Error: main.lua:16: 'then' expected near '='
--
here is my simple code:
function love.load()
love.graphics.setBackgroundColor(255, 255, 255)
totalTime = 30
gameOver = false
end
function love.update(dt)
totalTime = totalTime - dt
if totalTime <= 0 then
gameOver = true
end
end
function love.draw()
if gameOver = true then
love.graphics.print("GAME OVER", 100, 100)
end
end
I don't get why does Love tells that the syntax is wrong :/