0 Favourites

Question about Bullets and Collision

  • 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

  • Construct 3

    Buy Construct 3

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

    Buy 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)
Similar Topics Posts Views Last Post
Unread hot topic
353 32,105
yojona's avatar
yojona
Unread sticky
192 1,337,456
Kyatric's avatar
Kyatric Construct Team Support
Unread hot topic Locked topic
67 21,585
Ashley's avatar
Ashley Construct Team Founder