Know when Object is off screen.

Hey guys how do I figure out if a certain object is off the screen. Then If it is do something my code below.

if square.x \>= 480 then --square is the main player and the screen is in landscape mode print("it is off screen") end

Nope that won’t do it.  You’ll want a more sophisticated check to be sure it always works.

Try the code I posted here: http://forums.coronalabs.com/topic/55035-how-to-determine-if-sprite-is-on-screen/ 

https://forums.coronalabs.com/topic/55035-how-to-determine-if-sprite-is-on-screen/ 

Nope that won’t do it.  You’ll want a more sophisticated check to be sure it always works.

Try the code I posted here: http://forums.coronalabs.com/topic/55035-how-to-determine-if-sprite-is-on-screen/ 

https://forums.coronalabs.com/topic/55035-how-to-determine-if-sprite-is-on-screen/