@alexnvu welcome to the forums! (The problem with your code is that you have not defined
imagename
in setup) EDIT: Sorry, I didn’t see your second picture where you did define imagename.
What exactly is the problem you are experiencing? If you detail the problem people are more likely to help. And again, welcome to the forums! Be sure to post if you have any other problems, but always remember to try and solve them yourself first.
@TheSolderKing I’m trying to be able to grab the image and drag it around. I want to specifically grab the item and not be able to move the image unless I’m touching it and dragging it
displayMode(FULLSCREEN)
function setup()
img=readImage("SpaceCute:Beetle Ship")
x=WIDTH/2
y=HEIGHT/2
end
function draw()
background(40, 40, 50)
sprite(img,x,y,100)
end
function touched(t)
if t.state==BEGAN or t.state==MOVING then
if t.x>x-50 and t.x<x+50 and t.y>y-50 and t.y<y+50 then
x=t.x
y=t.y
end
end
end