How do I recognize specific instances?

0 favourites
  • 3 posts
  • Hi, I'm currently making a top-down action shooter. Basically, what I want to happen is when an enemy shoots and hits the player they swap positions with that enemy. My problem is when I have multiple instances of that enemy. When one of their bullets hits the player, all instances of the enemy end up swapping places with the player.

    Currently my set up is when the enemy has line of sight to the player, it shoots by spawning a bullet in front of it moving forwards at the angle it was facing. Is there a way for each bullet instance spawned to be tied to the specific enemy that spawned it (so that it recognizes which enemy the player swaps places with)? Or is there another way I need to be approaching the bullet spawning so that each bullet instance spawned is already tied to the enemy that spawned that bullet?

    I'm relatively new to Construct2, so I'm not too clear with some of the particular actions I'm allowed to make sprites do. I've been winging it this past week through trial and error and I really can't find a solution to this. Any help would be appreciated.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Store the enemy UID as an instance variable on the bullet, when it's created. Then Pick the enemy by that UID.

  • Store the enemy UID as an instance variable on the bullet, when it's created. Then Pick the enemy by that UID.

    Right, I'll read up on UIDs then. Thanks for directing me to the right direction.

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