0 Favourites

How do I alternate firing 2 guns with separate image points?

  • In my game, the main character is able to wield a gun in each of their hands. I would like to have it so that the guns alternate firing, instead of shooting at the same time. Here's a rudimentary doodle to show what I mean.

    I'm stumped on how to accomplish this. I can make both guns fire at the same time at the end of a countdown, but how do I make the guns alternate? I want them to shoot at the same firerate, but if I give them each a separate event with the same cooldown they obviously still shoot at the same time. It's making me feel like a real dummy!

  • throw a boolean in there somewhere. we'll call it "right".

    on each shot, check if "right" is true.

    if true, fire from right gun and toggle to false. if false, fire from left gun and toggle to true.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Same deal, unfortunately, but the issue now isn't with your solution (which I imagine does work):

    The way I have my actions set up, the game checks it for false and sets it to true, and checks it for true and sets it to false, at the same time. Which results in both guns firing at the same time. What's the proper order of operations to keep it from doing that?

  • i think you just need to add an 'else' before is player_right.

    see, on the check, if player_right is false, it shoots the bullet, and then sets player_right to true.

    ... and then it checks if player_right is true.. which it now is..

    an else will stop it from running that event until next check.

  • Ah-ha! I figured I was missing something like that. Thank you for the help, it works just fine now.

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