Move multiple objects to one point question

Get help using Construct 2

Post » Fri Apr 20, 2012 11:00 pm

Hey all,

I'm trying to create an RTS style game where I can select multiple units and move them around.

I have selection all worked out fine, and movement seems to be okay (I am using car movement to prevent overlap of the units when moving).

The one thing I am having a problem with is unit behavior once a location is reached.

Since all the units are trying to go to the same destination, once they are basically in the destination area, they keep pushing each other around trying to get to the destination point.

In reality, I want it to be that once they get as close to the destination point as possible, they all stop trying to move.

My attempts to achieve this:
1.) Once the units are within a specific distance of the point, stop moving (I have a bool for "Active" indicating that they should or shouldn't try to keep moving). This works well for small groups of units, but if I have a large group, the same behavior happens on the edges. If I scale the range up to accommodate large groups, the units never actually reach the destination point, so it seems really broken.

2.) What I want to do: If the unit collides with another unit that is inactive, it becomes inactive. That way, if I have the first unit become inactive once it gets very close to the goal, the rest of the units should also become inactive upon collision, kind of in a chain reaction. It sounds great on paper, but I don't know how to do this! The problem is that if I have a condition for "if unit collides with unit", I cannot check if the collided with unit is inactive, since all logic binds to the colliding unit.

Does anyone have any insight on how to do this? The game seems really broken when the units glitch out in an attempt to get closer to the destination any time you move several units.

Thanks!
B
3
Posts: 10
Reputation: 520

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 32 guests