Question about Bullets and Collision

0 favourites
  • 4 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • I seem to be having this problem when two objects are overlapping each other and a "bullet" hits the objects at the same spot. They are both getting hit (when the bullet should only be hitting one of the two). Is there a way to make one object only pick one other object upon collision?

    Basically the way the algorithm is set up, both mobs die at the same time, but only one is registering with my tracking algorithms. If I was expecting two mobs to die, but only one registers upon death, the player is only rewarded for one death. Sure I can track the number of destroys that happen, but the section of code that tracks the instance variable for health only seems to track it for one of the two mobs. The code looks like this:

    Family: Current HP <= 0 ---> addCash then Destroy

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could give the bullet a CanKill instance boolean, than dd the condition that it must be True to kill an enemy, when it hits an enemy immediately set it to False.

  • System: Bullet -> On Collision with Object

    System: Pick Object Instance 0 (pick nth instance)

    This will always pick the first instance in a collision event regardless of how many instances are returned.

  • I tried out theubie's suggestion and it seems to be working properly. EncryptedCow, I didn't get a chance to try out your suggestion =\... Thanks everyone!

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