Code: Select all
function love.load()
text1 = "Hi!"
end
function love.draw()
love.graphics.print(text1,400,300)
love.graphics.print(text2,400,500)
end
function love.update(dt)
text2 = "Something else"
end
Code: Select all
function love.load()
text1 = "Hi!"
end
function something()
text2 = "Something else"
end
function love.draw()
love.graphics.print(text1,400,300)
love.graphics.print(text2,400,500)
end
function love.update(dt)
end
My question is: What's the difference between love.update() and something()? Why is the variable created within love.update() global, and can be used even before it's declared?