How do I disable object registering in LoS behavior?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Is this possible? I might've written myself into a bit of a bind by not outright destroying objects.

    I have a group of sprites all in a container. One sprite is the base and the rest are targets attached to it that get shot at by the player and AI. Destroying a target in the code will obviously destroy the entire container, so instead I marked them as destroyed using variables and animations. Problem is, this doesn't prevent targets from registering in Line of Sight behavior and other code, so AI looking at a "destroyed" target will still consider it a valid target.

    Is there a way to make an object exempt from something like this?

  • LoS is just a condition, you can combine it with other conditions to filter out "destroyed" instances.

    Target Compare instance variable Destroyed=0      ->  AI Spawn bullet ....
    AI Has LoS to Target 
    [/code:37tpf4lk]
    
    First condition will pick all not destroyed targets. Second condition will check if AI has LoS to any of them.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Huh, I thought I'd tried that with no success. Seems to be working now though, maybe I just had to reshuffle the order of events. All's well that ends well.

    Thanks!

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