Problem with LOS/family, in need of help

0 favourites
  • 4 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi,

    I did some digging and couldn't find a clear solution to this, so I'm asking for help:)

    In short, I want the enemies to behave differently (change animation, speed, attack pattern,etc.) when the player is at different range. I used the Line of Sight behavior for the enemy family and did something like this:

    for each enemy

    -enemy has LOS to player

    --abs(player.X-enemy.X)>350 -------events

    --else

    ---abs(player.X-enemy.X)<150 --------events

    ---else --------events

    (and something else about enemy movement, but since it worked there's no need to put it here)

    However, when there are multiple instances from the enemy family, the player has to be within every instance's range for them to behave correctly. For example, if I want the enemy to play attack animation when abs(player.X-enemy.X)<150, every enemy instance has to be this close from player for them to play the animation together.

    And that's obviously not the plan. Could someone explain to me why this happened? Hope I described the situation clear enough. Thanks!

  • Bump. Still can't figure out why.

  • Well, removing that LOS line doesn't help at all, so I guess it's not about LOS behavior but the logic. Could someone tell me how to achieve that goal (a different set of events for every enemy-player distance range)?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alright, figured it out. I shouldn't have used function in the events.

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