Can someone tell me why it's not working?
Proobleem
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Proobleem
At line 18 you are overwriting your love.draw function you defined at line 10.
Re: Proobleem
Tjakka5 wrote:At line 18 you are overwriting your love.draw function you defined at line 10.
Code: Select all
gscore = 0
function love.conf(t)
t.window.width = 800
t.window.height = 600
end
function love.load()
krktr = love.graphics.newImage("krktr.png")
end
function love.draw()
love.graphics.draw(krktr, 350, 250)
love.graphics.print("Score = " + gscore, 0, 0)
end
function love.mousepressed(x, y, button, istouch)
if button == 1 then -- the primary button
gscore = gscore + 1
end
end
Re: Proobleem
Please read the posting rules first. Help us help you.
This is not how you do string concatenation in Lua:
Code: Select all
"Score = " + gscore
Code: Select all
"Score = " .. gscore
I recommend reading the Lua 5.1 reference manual, which might be a bit dry at first but it's a life saver.
I also strongly recommend reading Programming in Lua 3. Edition.
While it's aimed at a newer version of Lua than LÖVE uses, it's still largely relevant.
You might think that this takes too long, and that you prefer to try stuff out and learn like that, but trust me - you will save so much time if you read (or at least skim over) them first.
You will get better much more quickly and you will know where to look stuff up when you have a problem.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Proobleem
You should spend all your free time memorizing the Löve Wiki and Lua reference manuals. You absorb a lot of good information.
Re: Proobleem
Oh, thanks!undef wrote:
Please read the posting rules first. Help us help you.
This is not how you do string concatenation in Lua:This is how you do it:Code: Select all
"Score = " + gscore
Code: Select all
"Score = " .. gscore
I recommend reading the Lua 5.1 reference manual, which might be a bit dry at first but it's a life saver.
I also strongly recommend reading Programming in Lua 3. Edition.
While it's aimed at a newer version of Lua than LÖVE uses, it's still largely relevant.
You might think that this takes too long, and that you prefer to try stuff out and learn like that, but trust me - you will save so much time if you read (or at least skim over) them first.
You will get better much more quickly and you will know where to look stuff up when you have a problem.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Giapp, Google [Bot] and 5 guests