Container + turret problem

This forum is currently in read-only mode.
  • Hello all,

    I'm a bit new to Construct, but I've chewed through the demos and tutorials. So far, I've gotten pretty far on an idea but I'm currently stuck, even after searching through the forums.

    I'm trying to make a controllable row of soldiers. Nothing very fancy, just add a soldier sprite to a couple turrets, and add turrets to a rectangular container, right? Well, just one additional feature - I want to make the soldiers/turrets individually destructable. They get shot, go boom as individuals instead of ALL of them at once, basically. That's my goal.

    Is this possible with containers? if so, how?

    if not, what would be a good alternative?

  • I don't think thats possible with containers. I dont think containers were designed to be used for things like this.

    You can do this using variables and other things... No time right now so I'm sure someone else will reply and help you out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You want to use Pairer Object for this. You pair the soldier and turret, etc., when one gets shot, the other doesn't get destroyed.

  • Welp, I realized I didn't quite explain what I was wanting to do correctly. My goal is to make a controllable row of destructable units, that stay in formation. You control the entire row, not the individual units. Kinda like a unit of fighters in Home World. Each fighter in the row can be destroyed individually, but the player controls the entire row.

    The original idea I had was to use a container and turrets. You take a rectangle, attach 4 turrets to it in a row, and attach a soldier sprite to each turret. The problem is that if you pile everything into a container, and you destroy 1 turret, all turrets in the container get destroyed.

    Honestly, I think the RTS template included with Construct was a better way to do this. But I don't know of a way to make the units move in a row instead of an unorganized mob. I thought the container/turret idea was a simpler way to try to do it, but it might not work.

    Anyone have an idea on either option?

  • I would simply make each sprite have the turret behavior, as well as the rts movement behavior.

    You can then add each to a family, then when you have them move have them move with a for each saying

    for each family move to x,y + private variable

    >add x to private variable

    Any way Im not a 100% sure, but thats a good place to start experimenting.

  • If you trying to make groups of the same objects, add a private variable called 'group id' or something, and when you create say 4 soldiers, give them a number (such as a global variable that you can incriment).

    Then if you need to select a group, you can just compare the private variable. I'd also recommend adding a family because then you can do stuff like this:

    On left click soldier

    FamilySoldier - Select all with 'groupid' equal to soldier('group id')

    And then FamilySoldier will be all the soldiers in the group, and soldier will be the one you actually clicked on

  • Wow, better responses than I hoped for! The family and group selection ideas look like a great foundation to getting the rows going. Gonna try these tommorrow, er, later today now that it's so late, and see what I can come up with for movement.


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