0 Favourites

Problem with LOS/family, in need of help

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)?

  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
157 12,688
megatronx's avatar
megatronx
Unread hot topic
0 Favourites
Kiira will help! :D
132 16,604
Kiira's avatar
Kiira
Unread hot topic
98 7,591
norum82's avatar
norum82