Problem with LOS

0 favourites
  • 7 posts
  • Hi

    As the drawing shows I should wish that:

    • the unit had A LOS OK to the unit 1.
    • the units A had blocked the LOS to the unit 2.

    Is there a simple way to accomplish this?


  • I don't think that's possible unless you implement the LoS manually, instead of using the behavior.

  • So when unit 1 or 2 is overlapping the obstacle, it should be considered as in LOS?

    Don't think it's possible, but you can simply add overlapping check as another event. For example:

    1. UnitA has LOS to EnemyUnit -> UnitA fire bullet to EnemyUnit

    2. EnemyUnit is overlapping Obstacle -> UnitA fire bullet to EnemyUnit

  • Hey Angiel!

    I tried to simulate what you want using a second object with LoS (viewer) on top of the player. This object's LoS is identical to the players, except it uses custom obstacles and I add none, so, essentially it "sees through walls". What I do is I check if player has LoS and when it doesn't I check if the viewer has LoS and if the object is overlapping an obstacle.

    Check this capx: ... .capx?dl=1

    I don't know if it will serve your needs, but... Guess it's worth trying.

    Hope this helps. Cheers!

  • Thanks to everyone for the answers <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    dop2000 The system works; I just have to see the "cost" in% CPU and FPS

    brunopalermo Great !! I've modified your example:

    -Added a Player Unit (in my game between English and German I have more than 60 units)

    -Drag & Drop for player unit (faster check los)

    - A Player Unit if in an obstacle, he sees units outside

    Do you think it works? ... sp=sharing

    Here is a screenshot of my game

  • Hey Angiel!

    I'm currently at a Game Jam. Already downloaded your capx and, as soon as I can, I'll take a look at it and come back to you, ok?


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, Thanks.


    I added to Event 11

    spTopView - Has LoS to spEnemy------>

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