How do I make the health subtracted with instances

0 favourites
  • 3 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • Ok, so, the title is so weird and stupid, I don't know what to write there, but here we go.

    Well, my game is like this:

    Well, there's a lot of zombies, right? Firstly, if the zombies collided with the wall, the wall's health will decrease by 5. And it should, but, I thought that when the zombies hit the wall, it will subtract by the instances number. Not just subtract 5. It just subtracts 5! It should be if there's only one zombie but there's like 50 of 'em! It should subtract about 250 right off the bat. Not just 5. Is there anything that I can do to fix it??

  • If you are subtracting health on collision event, then it's very unlikely that 50 zombies will collide with the wall all at the same tick (1/60 of second).

    But yes, it is still possible that more than 1 instance will collide, so you need For each loop:

    Zombie On collision with Wall

    System For each Zombie -> Wall subtract 5 from health

    Or use the PickedCount expression:

    Zombie On collision with Wall -> Wall subtract (5*Zombie.PickedCount) from health

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you are subtracting health on collision event, then it's very unlikely that 50 zombies will collide with the wall all at the same tick (1/60 of second).

    But yes, it is still possible that more than 1 instance will collide, so you need For each loop:

    Zombie On collision with Wall

    System For each Zombie -> Wall subtract 5 from health

    Or use the PickedCount expression:

    Zombie On collision with Wall -> Wall subtract (5*Zombie.PickedCount) from health

    THANK YOU!!!!

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