Hey guys, another question here. This is for a small RTS prototype I’m working on for some fun, but I’ve hit a snag.
For examples sake, I’ve got two arrays, activeAgents and houseArray. A number of movieclips (player controled units/agents) are stored in activeAgents and houseArray is used to store any agent that is “inside” the house.
If an agent in activeAgents hitTests the house that houseArray belongs to and the agent ISN’T already in the houseArray, then I want to add the agent from activeAgents INTO the houseArray.
for(i=0; i<activeAgents.length; i++){
if(house.hitTest(activeAgents*._x, activeAgents*._y, true)){
for(h=0; this.houseArray[h] != activeAgents*; h++){
this.houseArray[h] = activeAgents*;
}
}
}
This was my most recent attempt, but obviously results in an infinite loop that sends Flash in to a spiral of death.
I’m honestly not sure how to achieve what I want to happen, so any and all ideas or info are welcomed and appreciated.
Thanks!