Move multiple objects to one point question

0 favourites
  • 1 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)