I am having a problem with a short game I am making. What I am trying to do is to get the taco to dissapear when it hits the sprite below it but I have no idea how to do it
Here is the code
function setup()
x=0
y=-50
speedY=-7
end
function draw()
background(220, 174, 23, 255)
sprite(“Tyrian Remastered:Boss A”, 400, 300)
if y>-50 then
sprite(“Documents:the taco”,x, y, 100, 74)
y=y+speedY
end
end
function touched (touch)
if touch.state==BEGAN and y<0 then
x=touch.x
y=touch.y
end
end
function setup()
x=0
y=-50
speedY=-7
end
function draw()
background(220, 174, 23, 255)
sprite("Tyrian Remastered:Boss A", 400, 300)
if y>-50 then
sprite("Documents:the taco",x, y, 100, 74)
y=y+speedY
end
end
function touched (touch)
if touch.state==BEGAN and y<0 then
x=touch.x
y=touch.y
end
end
@newow You just have to compare their x,y positions.
function setup()
x=0
y=-50
speedY=-7
end
function draw()
background(220, 174, 23, 255)
sprite("Tyrian Remastered:Boss A", 400, 300)
if x>350 and x<450 and y>250 and y<350 then -- compare x,y positions
y=-50
elseif y>-50 then
sprite("Documents:the taco",x, y, 100, 74)
y=y+speedY
end
end
function touched (touch)
if touch.state==BEGAN and y<0 then
x=touch.x y=touch.y
end
end