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

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
ethaboy
Prole
Posts: 1
Joined: Fri Oct 14, 2022 3:07 pm

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

Post 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
Attachments
main.lua
the code
(547 Bytes) Downloaded 55 times
User avatar
keharriso
Citizen
Posts: 98
Joined: Fri Nov 16, 2012 9:34 pm

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

Post by keharriso »

I think

Code: Select all

score - score + 1
should be

Code: Select all

score = score + 1
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games
User avatar
darkfrei
Party member
Posts: 1182
Joined: Sat Feb 08, 2020 11:09 pm

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

Post by darkfrei »

And please be sure that the function love.mousepressed is only one.
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
Post Reply

Who is online

Users browsing this forum: No registered users and 57 guests