suggestion: deactivate instance outside layout

0 favourites
  • 5 posts
From the Asset Store
Plugin Transition Layout C3. Layout opening and closing animation for C3. Quickly set up transitions between lay
  • automatically deactivate instance when they are not inside the layout.

    Disabled instances can not be chosen by infinite loop.

    This saves the cpu and ram.

  • Is this the sort of thing that you're after? The first condition ensures that the For-Loop will ignore those that are outside the layout....


  • This is not the intention of this thread.

    Btw. in your example you still check all instances. "Is not outside layout" return true or false from every instance. And it need more cpu as a simply for each loop.


    Just a suggestion for de-/activating instances feature. Scirra must decide whether they implement it.

    To disable instances means efficient CPU usage. For example in a platform game. The instances (blocks, enemies, etc.) outside the screen eat cpu resources. An alternative: Create the level like a endless autoscroll runner. Buts its hard to handle for complex levels.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • this could break projects where instances outside the layout is needed (simple exemple: an infinite runner where the player actually moves, which also helps a great deal with slopes compared to moving everything instead of the player), so it should be a choice by the user.

    a "disable picked instances" would be better IMO than just the ones outside layout, also off screen instances aren't drawn, and if you disable their behaviors, and do what colludium suggested, they (off layout instances) won't be checked for everything put after that, and if really you need to disable them, destroying them I think is the way to go, I'm pretty sure this feature you are suggesting would actually do this destroying/recreating silently.

  • DAG,

    You misunderstand the event system. Have a look at this quick demo - the Not Outside Layout condition excludes the objects that are outside the layout from the subsequent For Each Loop. You can use this technique to filter other conditions either in single event blocks or in tiered / cascading events to minimize the cpu load. It's extremely powerful, IMO.

    Edit - Otherwise you can use the outside layout check to deactivate them yourself manually, as Aphrodite said.

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