Buttons using love.mousepressed?
Posted: Fri Apr 17, 2015 5:57 am
If I use an if statement to check the x and y of the mouse, and if it was clicked, it will only run if the mouse was on that certain position.
How would I make it so that when a sprite's area is clicked, it would run a block of code?
Um.. this is what I mean...
How would I make it so that when a sprite's area is clicked, it would run a block of code?
Um.. this is what I mean...
Code: Select all
function love.mousepressed(x, y, button)
if x == xcoord and y == ycoord and button == "l" then -- xcoord and ycoord are the coordinates of the button, but it would only trigger on that ---exact position
--code
end