Call of Hats: Zombies

  • 105
    This content is deleted
    Game
    Call of Hats: Zombies
    190 favourites

    Shoot the zombie hats! Drink The slushies! Save the survivors in this top-down shoot-em-up.

    7 years ago
You're viewing a single comment in a conversation. View all the comments
  • 2 Comments

  • Order by
  • I'm not exactly sure how i did it, as I do not have the files, but I think I had two text objects, one for gun magazine and one for reserve. you'll need these variables: currentAmmo, currentReserve, maxAmmo

    when shooting, make sure to check that you have ammo and just minus one from the currentAmmo then set the text to currentAmmo

    when reloading you'd first want to check that you have reserve ammo to reload. then you'll also want to check how much ammo you can reload when you don't have enough for the entire clip: if (currentReserve < maxAmmo - currentAmmo) then set currentAmmo = currentReserve + currentAmmo, also set currentReserve = 0, and update your text

    finally if your currentReserve is greater than or equal to what you need to reload : if (currentReserve >= maxAmmo - currentAmmo) then set currentAmmo = maxAmmo, and set currentReserve = currentReserve - (maxAmmo - currentAmmo) then just update your text objects

    that's how i probably did it, hope it helps!