How do I Count bullet shot

  • Hi. In the game you have to hit a target. When 3 bullets were shot and no target were hit the game will restart. The problem is i added global variable that counts bullet shots, but when you shot the third bullet it automatically restart the game without waiting if the target was hit. Hope you understand the question.

    my eng sucks lol

  • Use the "On Destroyed" condition on the bullet. Add 1 to the global variable when a bullet is destroyed. And when a bullet hits a target, reset the global variable to 0.

    Make sure you destroy the bullets when they hit a target, wall, or are outside of the layout.

  • yeah , to be more specific, the bullets are actually Arrows that got pinned to wall if u missed a shot, So it not going to be destroyed, Any other idea?

  • Use the same mechanic, when arrow collides with wall, add 1 to global variable. Instead of adding 1 when you shoot it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That sounds like solution really, but what if the player shots in the air, the arrow got destroyed after leave the layout and it will no longer work ,

  • .............

  • Korbaach as always best answer.

    but thank you xavier for your time taken. Appreciated really

  • uff i am back here. Everything worked perfectly , until the second level of my game , where the arrow bounce from solids, so it has multiple collisions in 1 shot. It bounce from wall and floor and the counter no longer work :-/

  • Add an instance variable that tracks if it has ever hit. If not, set it and count it, else don't.

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