Proobleem

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
MYavuz
Prole
Posts: 3
Joined: Fri May 06, 2016 3:37 pm

Proobleem

Post by MYavuz »

Can someone tell me why it's not working?
Image
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: Proobleem

Post by Tjakka5 »

At line 18 you are overwriting your love.draw function you defined at line 10.
MYavuz
Prole
Posts: 3
Joined: Fri May 06, 2016 3:37 pm

Re: Proobleem

Post by MYavuz »

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
it still doesn't work
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: Proobleem

Post by undef »



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
This is how you do it:

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.
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Proobleem

Post by Jasoco »

You should spend all your free time memorizing the Löve Wiki and Lua reference manuals. You absorb a lot of good information.
MYavuz
Prole
Posts: 3
Joined: Fri May 06, 2016 3:37 pm

Re: Proobleem

Post by MYavuz »

undef wrote:

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
This is how you do it:

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.
Oh, thanks! ^^
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests