How to make limited ammo

  • I made a variable for every attack type which decays every time you shoot with that specific weapon type.

    My code line for shooting is "On key pressed.... player spawns X on image point 1"

    1) How do I make it impossible to shoot again when the variable equals zero? I want this object to not be able to spawn again if you have no ammunition.

    2) Also, how do I make my shots move at the opposite direction when my character is mirrored? (Without affecting the bullets already in air)

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you already have an ammo number variable, right click the 'On key pressed' condition, add another condition :

    System -> Compare variable -> "Ammo > 0". This will mean the object will only spawn if you press the key AND ammo > 0.

    To mirror the shots, I would change "player spawns X on image point 1" to "player spawns X on image point 1 at angle X" where X is a variable that changes depending on a Boolean that is true or false depending on wether the character is mirrored or not.

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