using if statements with mousepressed doesnt work
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
using if statements with mousepressed doesnt work
when i use love.mousepressed by itself it works, but when i use an if statement it stops working (and if i use an elseif statement keypressed stops working too :/)
Re: using if statements with mousepressed doesnt work
cooooooooode
paste code and or a .love file
paste code and or a .love file
butts
Re: using if statements with mousepressed doesnt work
Code: Select all
function love.load()
coolthing = love.graphics.newImage("awesome.jpg")
love.graphics.setBackgroundColor(255,255,255)
imgx = 0
imgy = 0
end
function love.draw()
love.graphics.draw(coolthing,imgx,imgy)
end
function love.mousepressed(x,y,button,istouch)
if button == "1" then
imgx = x
imgy = y
end
end
function love.keypressed(key)
if key == "x" then
imgx = 10
imgy = 10
end
end
Re: using if statements with mousepressed doesnt work
try
button is a number (starting with 0.10.0 https://love2d.org/wiki/love.mousepressed)
Code: Select all
if button == 1 then
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests