So i need a way to track the y of a specific object i have attempted to do this by myself multi able times and failed. i don’t have much to show but alot of nonworking code. This is what i have:
local function poof(self, event)
if(self.y == nil) then
return
end
if(self.y > display.contentHeight + 50) then
death:removeEventListener( “enterFrame”, self )
self:removeSelf()
print(“Ghost”)
end
end
elseif(math.random(1,10) > 3) then
death = display.newImage(“Death.png”,startX, -300)
physics.addBody( death )
death.enterFrame = poof
death:addEventListener( “eneterFrame”, poof )
death:addEventListener( “touch”, deathTouched )
In short i need a way elseif(math.random(1,10) > 3) then
death = display.newImage(“Death.png”,startX, -300)
physics.addBody( death )
death.enterFrame = poof
death:addEventListener( “eneterFrame”, poof )
death:addEventListener( “touch”, deathTouched )
In short i have a method of removing all objects that have gone off the screen but i need to know when a specific object has left the screen this way i can make the player lost life ect ect.
Any help would be amazing
Thanks
Pronoun