Help: spawn multiple objects at multiple angles

0 favourites
  • 8 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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.

    dl.dropboxusercontent.com/u/103925639/CAPx/TDWF.capx

  • 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.

  • Is each spread turret also supposed to be shooting 3 bullets? Right now each one is shooting two.

  • 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

  • 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.

    dl.dropboxusercontent.com/u/103925639/CAPx/TDWF.capx

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Potzero

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

    Perhaps your answer may lie there.

  • 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!

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