0 Favourites

Gun, burst-fire mode

  • 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

    <img src="http://i.imgur.com/ol5oQVe.png1" border="0">

    Any help to make this work will be appreciated.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

    <img src="http://i.imgur.com/ol5oQVe.png1" border="0">

    Any help to make this work will be appreciated.

    I'd probably do it something like this:

    for 0 ... to bulletsInBurst-1

    .. wait burstRate*loopIndex

    .. Spawn bullet

    .. Set variables

  • It's so beautiful! :')

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

    Thank you vee41!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)