Algorithm to make groups of units

Posted by M28 on Game Development See other posts from Game Development or by M28
Published on 2010-12-27T19:56:01Z Indexed on 2010/12/28 1:02 UTC
Read the original article Hit count: 709

In Age of Mythology and some other strategy games, when you select multiple units and order them to move to some place, they make a "group" when they reach the desired location:

Group

I have a Vector with several sprites, which are the selected units, the variables tarX and tarY are the target x and y. I just want an example, so you can just set the x and y position and I can adapt it to my code. Also, I would like to ask that the algorithm calls "isWalkable" for the x and y position, to determine if it's a valid position for each unit.

© Game Development or respective owner

Related posts about algorithm

Related posts about actionscript-3