Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

How do I deactivate object when it is offscreen?


jagd
 Share

Recommended Posts

I'm creating a game with a very large world which will all be loaded from the beginning of the game.  However, to cut down on resource use, I want to make it so objects will only do stuff if they are in the player's view.  For example, an object that spawns a rockslide will only do so if it is within the player's view--or 'on-screen' if you want to use that term.

 

How do I do this?  Is there a way to say something like,

 

if(Object.isOnScreen){

 

}

Link to comment
Share on other sites

i assume there is something in the Phaser Camera class that would be able to help you. You can use the position and its viewing rectangle to tell if something is in your view I think. haven't tried it, but that is where I would look

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...