Help: spawn multiple objects at multiple angles

Get help using Construct 2

Post » Thu May 30, 2013 9:05 pm

Hi peeps. I need some help and a fix for my issue. Im trying to learn the programming to make a tower defense game. As it stands, I want the "Spread" turret to shoot 3 bullets. However, if you place multiple Spread turrets, the other bullets refer to the 1st turret's angle. I do not know the correct commands to set it up so the bullet go in the correct direction. I currently have it set up so two bullets are 20 degrees offset from the middle. If there are some experienced construct 2 users, any help in this issue would be greatly appreciated. Thanks. Here is the capx.

https://dl.dropboxusercontent.com/u/103925639/CAPx/TDWF.capx
B
6
S
1
Posts: 11
Reputation: 597

Post » Thu May 30, 2013 9:08 pm

@Potzero

http://www.scirra.com/forum/topic45416.html Probably answered in one of those.

Worth checking it out; I don't know the answer myself though sorry.
B
20
S
7
G
4
Posts: 322
Reputation: 4,521

Post » Thu May 30, 2013 9:19 pm

Is each spread turret also supposed to be shooting 3 bullets? Right now each one is shooting two.
B
16
S
4
Posts: 24
Reputation: 1,009

Post » Thu May 30, 2013 9:31 pm

Try moving the angle adjustments into event #36, where the bullets are created. I think this will reference the correct turret. I cannot edit your capx because I am using the free version and you are over 100 events (I think you could easily reduce the # of events in your project, though...)

Spread Shoot--------------->Spread---->Spawn Bullet 1
                            Bullet 1-->Set angle to Spread.angle-20
--------------------------->Spread---->Spawn Bullet 2
                            Bullet 2-->Set angle to Spread.angle
--------------------------->Spread---->Spawn Bullet 3
                            Bullet 3-->Set angle to Spread.angle+20
B
16
S
4
Posts: 24
Reputation: 1,009

Post » Thu May 30, 2013 10:03 pm

Thanks for the responses.
@Sulli -- I have checked that list, but will check again for a solution.
@pseudotropheus -- thanks, that was an error on my part. I fixed some code and updated the capx. I still have the same problem unfortunately. Three bullets are supposed to come out of each spread turret, which does happen, tho after the first turret, the rest of the bullets are taking the first turrets' bullets' path. I cannot seem to get the code to set up separate paths for each series of bullets. I did create a container for each series of bullets to make it easier, but it didn't help the angle/direction problem.

Heres the updated capx.

https://dl.dropboxusercontent.com/u/103925639/CAPx/TDWF.capx
B
6
S
1
Posts: 11
Reputation: 597

Post » Thu May 30, 2013 10:09 pm

You didn't integrate my suggestion about spawning the bullets (and then adjusting their angles) inside event number #39, where the turret actually shoots.

If you cut some extraneous events I could play with it and show you.
B
16
S
4
Posts: 24
Reputation: 1,009

Post » Thu May 30, 2013 10:14 pm

@Potzero

http://dl.dropbox.com/u/5426011/examples%209/turret.capx

Perhaps your answer may lie there.Sulli2013-05-30 22:14:48
B
20
S
7
G
4
Posts: 322
Reputation: 4,521

Post » Fri May 31, 2013 1:11 am

Thanks for the responses.
@Sulli -- that was a good sample. I liked the pick nearest command event. Didn't even know about that one. Thanks.
@pseudotropheus -- I apologize I missed it the first time, but your suggestion was right. It's hard for me to believe that a simple fix like that was all it took. I tried all kinds of things with UIDs and IIDs earlier, but moving the triggers to turret shooting event worked. Thanks so much!
B
6
S
1
Posts: 11
Reputation: 597


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests