0 Favourites

Need help with Multiple Instances

  • Hi everyone,

    I have 2 issues here and I don't find any solution. Even by using UID.

    I have 2 enemies that are the same sprite.

    They have Line of Sight, Path finding and solid behavior.

    When the Player is in Line of Sight Range of one of the sprites, the sprite who detects the Player moves. When the distance between Sprite and Player is <40, Enemy sprite stops and plays "Attack"animation.

    This behavior works for the original sprite but not for the instance

    Each sprite detects the Player normally and behaves correctly except for attacking <img src="smileys/smiley18.gif" border="0" align="middle" />

    As you can see the picture below.

    At the bottom, the original sprite works.

    At the top of the pic, you can see that the instance overlaps the Player and does not perform his attack.

    In the middle, if the original sprite reached the Player and then the instance reached the Player, both sprites play their "Attack" animation but they overlap the Player instead of stop at 40 from the Player.

    <img src="https://www.dropbox.com/s/t6hhknwq7yep8gy/MultipleEnemies.jpg" border="0" />

    Do you notice anything wrong on the capx?

    In addition, I would like to have both sprites surround the Player instead of overlapping each other. Is there a way to say, if Player left side is occupied by an enemy, search other side (right/top/bottom)

    If the four sides are occupied, stay at X from Player and check if one side becomes free?

    Thanks

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I resolved it :)

    I needed to pick instances by evaluating distance.

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