# Projectile limit

**URL:** https://forum.makecode.com/t/projectile-limit/2586
**Category:** Help
**Created:** [June 30, 2020, 2:56pm UTC](https://forum.makecode.com/t/projectile-limit/2586 "2020-06-30T14:56:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Coreyhughes2020](https://avatars.discourse-cdn.com/v4/letter/c/a587f6/32.png) [@Coreyhughes2020](https://forum.makecode.com/u/Coreyhughes2020)
#### Post date: [June 30, 2020, 2:56pm UTC](https://forum.makecode.com/t/projectile-limit/2586/1 "2020-06-30T14:56:03Z")

</div>

Hey

Is there a way where you can set a number of projectiles. So for example if you overlap with something you get 5 projectiles you can use?

---

<div class="post-metadata">

### Author: ![shakao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shakao/32/113_2.png) [@shakao](https://forum.makecode.com/u/shakao)
#### Post date: [June 30, 2020, 3:07pm UTC](https://forum.makecode.com/t/projectile-limit/2586/2 "2020-06-30T15:07:49Z")

</div>

Yep! Try this code:

> **[reload projectiles](https://arcade.makecode.com/69804-81939-56752-83188)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Basically you save the number of projectiles remaining in a variable, and decrease variable that every time you fire. Then when you overlap the reload mechanism, you reset “projectiles remaining” to the full amount.

---

<div class="post-metadata">

### Author: ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)
#### Post date: [July 1, 2020, 12:24pm UTC](https://forum.makecode.com/t/projectile-limit/2586/3 "2020-07-01T12:24:43Z")

</div>

Really nice! I’ve always tried doing this before but this is unbelievable!

---

<div class="post-metadata">

### Author: ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)
#### Post date: [July 10, 2020, 6:17am UTC](https://forum.makecode.com/t/projectile-limit/2586/4 "2020-07-10T06:17:10Z")

</div>

Actually i want to say that you could stand at the chest and earn infinite ammo

---

<div class="post-metadata">

### Author: ![shakao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shakao/32/113_2.png) [@shakao](https://forum.makecode.com/u/shakao)
#### Post date: [July 10, 2020, 4:50pm UTC](https://forum.makecode.com/t/projectile-limit/2586/5 "2020-07-10T16:50:22Z")

</div>

Yeah, good point! This becomes kind of a game design question–there’s a couple ways I can think of to prevent infinite reloads.

- You could design the map for the game with the enemies (or the exit portal, or the treasure room) far away from the reload point, forcing the player to have to move away from the reload to fight.
- We could disable shooting while you’re standing on the reload point.
- Ammo reloads could be one-time use, like health packs. Maybe during a big boss battle you would put several reload packs around the room.
- The player could have to “spend” points to reload, so each reload reduces your final score.

There’s pros and cons of each based on the details of the game you’re building, and this is definitely not a complete list–I’m sure there’s tons of alternatives I haven’t thought of!

---

<div class="post-metadata">

### Author: ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)
#### Post date: [July 11, 2020, 4:15am UTC](https://forum.makecode.com/t/projectile-limit/2586/6 "2020-07-11T04:15:40Z")

</div>

Thats nice!

---

<div class="post-metadata">

### Author: ![Coreyhughes2020](https://avatars.discourse-cdn.com/v4/letter/c/a587f6/32.png) [@Coreyhughes2020](https://forum.makecode.com/u/Coreyhughes2020)
#### Post date: [July 14, 2020, 12:06pm UTC](https://forum.makecode.com/t/projectile-limit/2586/7 "2020-07-14T12:06:39Z")

</div>

Thanks everyone!
