Projectile limit

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?

Yep! Try this code:

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.

1 Like

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

1 Like

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

1 Like

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!

1 Like

Thats nice!

1 Like

Thanks everyone!