How do I make sure all my enemy deaths are counted

0 favourites
  • 5 posts
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • hi I am making a on rails arcade gun game and I want the player to be able to throw grenades

    so first I made a large explosion sprite and I used the simple code

    if grenade overlap enemey then reduce enemy hp by 10

    but while that seemed to work when groups of enemies got hit they did die BUT they did not all add to the bodycounter

    bodycounter is a global variable I use to determine when all the badguys in a room are dead so the camera can move to the next room.

    so I tried something else

    and it still does not work.

    if I have a group of 4 enemies and hit them with a grenade it only adds 2 points to bodycounter what can i do to make sure all the badguys are counted

  • You didn’t show the event that adds to bodycount. The rest is unrelated.

    The event should look like this:

    Badguy: hp < 0
    For each badguy
    — destroy badguy
    — add 1 to bodycount

    Without the “for each” there could be cases where more than one bad guy has hp less than 0, but only 1 is added.

    I guess you could do this instead which would also work:

    Badguy: hp < 0
    — destroy badguy
    — add badguy.pickedcount to bodycount
  • sorry for my delayed responce.

    I been giving it a go both the for each and pickedcount but no such luck if I flood the screen with grenades my body count is still below what it is meant to be

  • It looks like it should be working. I’m out of ideas with the information provided. I probably am missing something. I’ll defer to whoever else has ideas.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well thanks for trying if I can't fix it I might just remove grenades from the game

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