How do I have new sprites with line of sight behavior use custom obstacles?

0 favourites
  • 6 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I have a line of sight behavior setup using custom obstacles how I want it.

    New sprites created seem to default to using solids as obstacles. So even if I add the custom obstacles I want, this behavior still uses solids instead of my custom objects.

    There is no action to set the property to custom objects (instead of solids). And there is no expression to even check this.

    Is there a way to have a line of sight behavior created through events (so not in the layout in the editor) to use custom obstacles?

    A further detail in my project - this sprite with the line of sight behavior is in a container. Therefore, it is created via the container functionality.

  • You can set default properties by having at least once instance of the sprite places in the layout editor, even if the layout is not used otherwise.

  • You can set default properties by having at least once instance of the sprite places in the layout editor, even if the layout is not used otherwise.

    I did have one instance in the layout but new instances created did not keep those same default properties.

    I figured out a workaround where I can put multiple instances in the layout, one for each container I will need, and they keep the default property. I assume that is because the container uses the existing ones, not creating new ones.

    Not ideal if I want to, for example, dynamically create/spawn enemies using line of sight. For this current situation, I only need a set amount so can continue with this workaround, for now.

    Good note that I can use a different layout, even if not used. I will test that as well.

  • If newly created instances don't spawn with the default properties, that could probably be fixed with a bug report.

    Do you have any instances at all of that particular object that are placed in the layout editor that do have solids set as obstacles? It might be taking from that as the default instead.

  • If newly created instances don't spawn with the default properties, that could probably be fixed with a bug report.

    Do you have any instances at all of that particular object that are placed in the layout editor that do have solids set as obstacles? It might be taking from that as the default instead.

    I figured it out based on your two comments - this object was in a different layout, that I hadn't been used recently, so I did not update the settings there as well.

    Once I either updated it or deleted it from that layout, it worked as expected!

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just a note on this: it’s helpful to use Templates to avoid situations like this. Make sure your “prefab” object is set to template mode and then use that for whenever you need to spawn the object.

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