How do I make objects load on entering window?

0 favourites
  • 2 posts
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • I have a big layout with hundreds of objects that move. I want them to only load when the player gets near them. How can I do this?

    Alternatively, will it still affect performance if I just disable the object's ability to move when they are out of vision?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • With hundreds of objects you should definitely disable behaviors for objects which are too far away. You can use "Is on screen" condition or distance() expression. So you can do something like this:

    Every 2 seconds:
     Pick EnemiesFamily where distance(EnemiesFamily.x, EnemiesFamily.y, Player.x, Player.y)<2000
    	EnemiesFamily enable behaviors
    
     Pick EnemiesFamily where distance(EnemiesFamily.x, EnemiesFamily.y, Player.x, Player.y)>2000
    	EnemiesFamily disable behaviors
    
    

    Note, that if you have too many objects, even disabled behaviors can affect performance. You might want to create objects only when player gets close to them, and destroy objects which are left far behind.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)