0

2 人の敵を攻撃モードに設定したいのですが、現状では最後に追加した敵だけが攻撃モードに設定されています。

これを回避する方法はありますか?ヒントや提案をいただければ幸いです。さらにコードが必要な場合は、お知らせください。

  -(void)ViewDidLoad {
  for (_enemyPoint in [self.enemyGroup objects]) {
  self.enemy = [[CCSprite alloc] initWithFile:@"Icon.png"];
  self.enemy.scale = 32.0f/57.0f;
  self.enemy.position = CGPointMake([_enemyPoint[@"x"] integerValue],    [_enemyPoint[@"y"] integerValue]);
  [self addChild:self.enemy];
    }
  self.pathfinder = [HUMAStarPathfinder pathfinderWithTileMapSize:self.tileMap.mapSize
                                                         tileSize:self.tileMap.tileSize
                                                           delegate:self];
    [self enemyAttack];

                    }


  - (void)enemyAttack{

self.epath = [self.pathfinder findPathFromStart:self.enemy.position
                                          toTarget:self.player.position];
self.eactions = [NSMutableArray array];


for (_epointValueInPath in self.epath) {
   self.epoint = _epointValueInPath.CGPointValue;

   self.emoveTo = [CCMoveTo actionWithDuration:1.0f position:self.epoint];
    [self.eactions addObject:self.emoveTo];

}

self.esequence = [CCSequence actionWithArray:self.eactions];
[self.enemy runAction:self.esequence];
  }
4

2 に答える 2