How do I prevent objects outside layout from being detected

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • So let's say I have an enemy object that gets spawned at game time. Construct 2 forces me to keep an instance of that object on the layout so it can be used. My problem is that turrets and distance measurements will detect this object even when it is outside the layout.

    If I delete the last object it warns me I'm deleting the last instance of the object and the game will not run.

    How do I prevent these objects from becoming turret targets or actually even being visible to players on in the layout?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Either use Destroy on Start of layout, or place them in an extra Layout, just for assets.

  • First two things that come to mind: 1) There's a Destroy Outside Layout behavior that'll automatically destroy the object if it's out of bounds. Only issue is if you need objects to spawn outside layout and come in from the edge of the screen. 2) Destroy the object using On Start of Layout event, this will remove it at the start but later instances can still go outside the layout.

    For the other events you'll need to add another condition that checks if the object is outside layout. So e.g.

    Object distance to X is Y + Object is not outside layout --> Do X

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