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

Get help using Construct 2

Post » Sun Aug 28, 2016 10:15 pm

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.

Image

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!
B
18
S
9
Posts: 103
Reputation: 1,817

Post » Sun Aug 28, 2016 11:03 pm

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.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sun Aug 28, 2016 11:23 pm

Same deal, unfortunately, but the issue now isn't with your solution (which I imagine does work):

Image

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?
B
18
S
9
Posts: 103
Reputation: 1,817

Post » Sun Aug 28, 2016 11:29 pm

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.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sun Aug 28, 2016 11:31 pm

Ah-ha! I figured I was missing something like that. Thank you for the help, it works just fine now. :D
B
18
S
9
Posts: 103
Reputation: 1,817


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests