How do I create a specific movement for each instance of a family ?
I'm working on a ranged ennemy for a "rogue-like game".
here's his how he's working:
for each EnnemyRanged -> Set EnnemyRanged.DistanceToPlayer=sqrt((self.X - Player.X)^2 + (Self.Y-Player.Y)^2)
( EnnemyRanged.DistanceToPlayer < EnnemyRanged.SafeDistance ) -> Set EnnemyRanged.focus 2
Else ( EnnemyRanged.DistanceToPlayer >= EnnemyRanged.SafeDistance and ( EnnemyRanged.DistanceToPlayer <= EnnemyRanged.DetectionRange ) -> Set EnnemyRanged.focus 1
Else ( EnnemyRanged.DistanceToPlayer > Ennemy.DetectionRange ) -> set EnnemyRanged.focus 0
focus= 0 -> stop
focus=1 -> find path to player.x,player.y and move along
focus=2 -> enemy flee (too long to write)[/code:ma3r0yiq]
I've tried to use "for each instance" and "pick by UID" but seem like it doesn't work at all.
when i run my game it's the nearest ennemy who defined the movement of all the instances of this family, for instance all the ennemy go to the same place.
I want to each instance to determinate where he must go...