Hey guy i am having a little problem developing my new app. i am trying to detect when a object y position is grater then the screen size, if its grater then the screen size it would remove the object this my code
function spawnblcok()
block = display.newImageRect(“block01.png”, 45, 45);
block:setReferencePoint(display.CenterReferencePoint);
block.x = math.random(-10, 300);
block.y = -40;
transition.to( block, {time = math.random(2000, 8000), x = math.random(-10, 400) , y = 600,});
physics.addBody(block, “dynamic”, {density = 0.1, bounce = 0.1, friction = .1, radius = 0});
--Adding touch event
block:addEventListener(“touch”, touchUp)
if block. y > display.contentHeight then
print “remove objects”
end
end
total_block = 10
timer1 = timer.performWithDelay(1000, spawnblcok, total_block);
this is the part of code thats not working
if block. y > display.contentHeight then
print “remove objects”
end
can someone help thanks ! 