Line Of Sight and Families Weirdness

0 favourites
  • 6 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • I am trying to figure out something weird going on. Maybe I just cannot wrap my head around the problem.

    https://imgur.com/5HbO6ct

    • Enemys spawn and then find path to the next checkpoint.
    • If along the path they get a LineofSight to a Player_Solider they "Pathfinding STOP" and set the variable EnemyX to Player_Soldier.X, and variable EnemyY to Player_Soldier.Y , so this way it can store its target. (there may be an easier way, but not sure).
    • Bullets Fire, Everything is smooth until one of the Enemy soldiers loses line of sight of its target.

    So when the enemy loses line of sight and doesn't have sight to anything else it should follow the ELSE code and set SeesEnemy to 0 along with EnemyX to 0 and EnemyY to 0, and then find path to its target (didnt screenshot that part). Instead it will just sit there and fire until the other Enemys that still have a LineofSight destroy their target. Then they all move again, or they all just sit and continue firing at nothing.

    Any help is appreciated. What am I doing wrong?

  • Its almost like there needs to be more to the LineofSight behaviour. Like a "HasLineOfSight = True or False" or "LineofSight_Target = UID" to use in events. The invert doesn't work very well or at least I am not able to get it to work very well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:3w4z38dp]So when the enemy loses line of sight and doesn't have sight to anything else it should follow the ELSE code and set SeesEnemy to 0 along with EnemyX to 0 and EnemyY to 0, and then find path to its target (didnt screenshot that part)

    The error could be in that part. Could you share the screenshot of all events related to line of sight and pathfinding?

  • Easier to just provide CapX https://drive.google.com/file/d/1UvdnmT ... sp=sharing

    here is image with all of the code if you dont want to download the capx https://imgur.com/a/soCWF

  • Thanks for the capx. So what's happening is when at least 1 enemy has line of sight, "Else" event is not executed for other enemies, which don't have LOS.

    You need to change your event to this:

  • Dang! I knew it had to be something stupidly simple. Thank you.

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