How to make limited ammo

Just started using Construct 2? Post your questions here

Post » Thu Apr 03, 2014 12:37 pm

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.
B
2
Posts: 1
Reputation: 152

Post » Thu Apr 03, 2014 1:09 pm

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.
Intermediate level Construct 2 developer, looking to build up my portfolio : https://seriouslycrunchy.itch.io/

Current projects : Bite Sized Game Development, please have a look at my tutorials and comment!

I also write for http://moonbooks.net/, please come and check us out!

Follow me on twitter! @SrslyCrunchy I'm always looking for games or templates to highlight, use the hashtag #madeinconstruct !
B
15
S
6
Posts: 52
Reputation: 3,016


Return to Beginner's Questions

Who is online

Users browsing this forum: Anonnymitet and 2 guests