How do I set the line of sight to go to the closest object?

0 favourites
  • 15 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • If I move my line of sight, I want to only be able to see what is closest.

    If what is closest moves, I want it to switch to what is behind that.

    Thanks!

    Edit: Essentially, what do I set the Set LineOfSight Range to?

  • you can use the System Pick Nearest event.. then check the speed or however you determine it is "moving"

  • Thank you! What do I enter under "range" for that?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The pick nearest event/condition doesn't have a range..

    When using pick nearest the way described below you can set your range to whatever you want for only the nearest enemy within LOS will be used for the actions.

    player has line of sight to enemy

    enemy pick nearest to player.x,player.y

    player shoot at enemy

  • I have sprite_3 (my player) has LOS to object angel_01 (enemy) but can't seem to find pick nearest under actions

  • It's not an action, it's a condition..

  • it's not an action.. its an event. it's under System

    it sounds like you need to use it as a "sub-event"

    I can't tell what you are trying to do.. but it should be something like this

    CHECK the RANGE in a top level event like this:

    if range < 200

    (add a sub_event of this check) System Pick Nearest sprite etc... then add an action once you pick the nearest sprite...

  • it's not an action.. its an event. it's under System

    it sounds like you need to use it as a "sub-event"

    I can't tell what you are trying to do.. but it should be something like this

    CHECK the RANGE in a top level event like this:

    if range < 200

    (add a sub_event of this check) System Pick Nearest sprite etc... then add an action once you pick the nearest sprite...

    jobel

    it's not a system event or condition, pick nearest is an object event/condition..

    so you don't use system pick nearest, but sprite pick nearest to a specific point..

  • For pick instances, all I have are

    Pick All

    Pick by Evaluate

    Pick overlapping point

    Pick by comparison

    Pick nth instance

    Pick Random Instance

    but no nearest

    What I'm trying to do is make it so the angels freeze when the light is on them. However, if one is behind another, in its "shadow," it is free to move around it.

  • For pick instances, all I have are

    Pick All

    Pick by Evaluate

    Pick overlapping point

    Pick by comparison

    Pick nth instance

    Pick Random Instance

    but no nearest

    What I'm trying to do is make it so the angels freeze when the light is on them. However, if one is behind another, in its "shadow," it is free to move around it.

    It is not a system event, it's an event of the object..

    So: "Angel_01 pick nearest" and not: "system pick nearest.

  • oh sorry my bad.. I always mix that up.. you select the sprite you want, then under Size/Position you will see pick nearest.

    otaconnor you should do one of the "picking" tutorials, it will help you understand it better..

  • Is there a screenshot you could possibly send? I feel like an idjit but I'm still not finding it.

  • Oh okay! I will check that, as well as a picking tutorial. If I'm still a dingdong I'll check back but thank you so far!

  • right click the event

    add another condition

    choose angel_01

    choose pick nearest (It's in the Size & Position - part)

  • What do I set the range to in that case, for the action range? To make the LOS stop at nearest angel

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