Gun, burst-fire mode

Get help using Construct 2

Post » Sat Jul 06, 2013 3:59 pm

Just to be clear:
When I say "Burst-Fire", I mean a gun shooting a number of successive rounds with a single pull of the trigger.

With the code I have so far, I can make an Automatic/Semi-Automatic Rifle/SMG/Pistol/Shotgun/Spreadgun. You name it.

But for the love of god I am struggling to figure out how to make it burst-fire.

I've tried using loops and calling the same function within itself to no avail.

Here is a the section of my code:
- At the top is the conditions that need to be met for the function to be called.
- the "weapon.bulletsPerBurst" is what determines the weapon to be a single-shot or spread-shot.
- "weapon.burstRate" is what I use to determine how many times that weapon shoots successively.

Event Sheet Snapshot


Any help to make this work will be appreciated.
B
9
S
3
Posts: 40
Reputation: 2,261

Post » Sat Jul 06, 2013 5:46 pm

[QUOTE=aznmonkeyboy] Just to be clear:
When I say "Burst-Fire", I mean a gun shooting a number of successive rounds with a single pull of the trigger.

With the code I have so far, I can make an Automatic/Semi-Automatic Rifle/SMG/Pistol/Shotgun/Spreadgun. You name it.

But for the love of god I am struggling to figure out how to make it burst-fire.

I've tried using loops and calling the same function within itself to no avail.

Here is a the section of my code:
- At the top is the conditions that need to be met for the function to be called.
- the "weapon.bulletsPerBurst" is what determines the weapon to be a single-shot or spread-shot.
- "weapon.burstRate" is what I use to determine how many times that weapon shoots successively.

Event Sheet Snapshot


Any help to make this work will be appreciated.[/QUOTE]

I'd probably do it something like this:

for 0 ... to bulletsInBurst-1
.. wait burstRate*loopIndex
.. Spawn bullet
.. Set variables
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Sat Jul 06, 2013 8:11 pm

It's so beautiful! :')

I still don't fully understand the logic of this but it works!

Thank you vee41!
B
9
S
3
Posts: 40
Reputation: 2,261


Return to How do I....?

Who is online

Users browsing this forum: jkmalau, MoscowModder, terence951, vegapomme27, Yahoo [Bot] and 9 guests