I thought you could use 'imgx' and 'imgy', but that doesn't seem to be working with my newest script. I swear imgx and imgy worked for my last script, but...
Here's the code, in case you need it.
Code: Select all
local image
function love.load()
image = love.graphics.newImage("Images/smiley.png")
local f = love.graphics.newFont(1)
love.graphics.setFont(f)
love.graphics.setBackgroundColor(50,50,255)
end
function love.draw()
love.graphics.draw(image,imgx,imgy)
end
function love.update(dt)
local h,w = image:getHeight(),image:getWidth()
local onimage = h - imgy <= mouse:getY() and w - imgx <= mouse:getX() and mouse.isDown("w") or false --ERROR LINE
if onimage then
imgx = mouse:getX() + (w/2)
imgy = mouse:getY() + (h/2)
end
end
Attempt to perform arithmetic on global 'imgy' (a nil value)