I have a scrolling background, a building with window. As the viewport scrolls, windows will come in and out of view of the user. I would like images to appear in the windows every few seconds but only if the windows are in the current viewport. Each window is represented as a sprite on top of the background. How do I detect if the current sprite is within the viewport? Thanks!
Develop games in your browser. Powerful, performant & highly capable.
I think you can find in documentation.
Its in common condition
"Is on-screen:
True if any part of the object's bounding box is within the screen area. This is not affected by the object's visibility or opacity."
Thank you - that was exactly what I was looking for!