How do I create alternating bullets

Get help using Construct 2

Post » Wed Mar 05, 2014 7:16 am

hi, i want to have 2 weapons being held by a top down player. How do i game the weapons alternate?
B
1
Posts: 4
Reputation: 133

Post » Wed Mar 05, 2014 7:56 am

First thought is

assuming you mean that you have two weapons that you want (on a key/mouse press) to fire weapon a for one shot then weapon B for the next shot.

You could do it with a flag/counter/variable that is set to "left"
when the gun is fired then gun left routine is called and at the end of this routine the flag is set to "right"
so when the gun is fired again it will call the fire right routine

so in pseudo code it would be something like

on mouse pressed
--if "left" then -- spawn left bullet at left location : set flag to "right"
--else -- spawn right bullet at right location : set flag to "left"


not tested but sounds right - I will try to put up a capx soon.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Mar 05, 2014 8:11 am

capx

(two versions one using a string variable and one a boolean - I would go with the boolean for this left/right example)
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Mar 05, 2014 9:40 am

Here is a different way..
You do not have the required permissions to view the files attached to this post.
B
51
S
16
G
9
Posts: 1,098
Reputation: 11,252


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests