Page 1 of 1

function love.mousepressed(x, y, button, istouch, presses ) code line not working

Posted: Fri Oct 14, 2022 3:13 pm
by ethaboy
Hi, would like some help with the code line it seems to not be working and i am new to love and don't fully understand
function love.mousepressed(x, y, button, istouch, presses )
if button == 1 then
score - score + 1
end
end
it is supposed to draw a circle this code would make it so when pressed is would give the player 1 point for every press with the left mouse button, I don't understand why it is not working

Re: function love.mousepressed(x, y, button, istouch, presses ) code line not working

Posted: Fri Oct 14, 2022 9:03 pm
by keharriso
I think

Code: Select all

score - score + 1
should be

Code: Select all

score = score + 1

Re: function love.mousepressed(x, y, button, istouch, presses ) code line not working

Posted: Fri Oct 14, 2022 9:08 pm
by darkfrei
And please be sure that the function love.mousepressed is only one.