Beginner Coding Problem
Posted: Tue Dec 10, 2013 11:13 pm
In my simple game, you must rebuild your houses after a natural disaster. But it seems that I have run into a dilemma. When the "z" key is pressed, I want a house drawn, given there is 50 lumber in the stockpile. During the debugging, when I press the "z" key, no house appears, nor is 50 lumber subtracted.
Here's the code:
I don't understand the problem. Could you possibly explain to me my errors?
Here's the code:
Code: Select all
smallshack = love.graphics.newImage("smallshack.png")
function love.keypressed(key)
if key == "z" then
lumber = lumber - 50
love.draw()
x = 200
y = 200
love.graphics.draw(smallshack, x, y)
end
end