How do I prevent objects outside layout from being detected

Get help using Construct 2

Post » Sat Jul 30, 2016 2:17 am

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?
B
9
S
2
Posts: 4
Reputation: 533

Post » Sat Jul 30, 2016 2:36 am

Either use Destroy on Start of layout, or place them in an extra Layout, just for assets.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Sat Jul 30, 2016 2:43 am

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
B
54
S
24
G
18
Posts: 295
Reputation: 13,140


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests