I'm having a problem with moveTo when a collider is destroyed. I'll explain the situation.
I'm telling a soldier to moveTo(1,1) and when he collides with the "enemy", I'm telling him to moveTo(x, y)(stop), fight and than kill the enemy,
than I'm telling him to moveTo(1,1). This works fine.
But when 2 soldiers are told to moveTo(1,1) and if they collide with the enemy they fight him and kill him only one is continuing to point(1,1).(with my code)
Soldier -> onCreate -> moveTo(1,1);
Soldier -> onCollide -> Script,
- Code: Select all
int axeman; // 1 - alive, 0 - dead, axeman(enemy)
//DestroyTimer("axeman_rate");
//CreateTimer("Event Actor", "axeman_rate", 500);
axeman = collide.isAlive;
if(axeman == 1)// is alive
{
MoveTo("Event Actor", x, y, 1.000000, "Game Center", "");//stop
collide.HP = collide.HP - Attack;//fight
}
else// not alive
{
MoveTo("Event Actor", 320.000000, 170.000000, 4.000000, "Game Center", "wall");//continue
}
if(collide.HP <= 0)//killed
{
axeman = 0; // dead
MoveTo("Event Actor", 320.000000, 170.000000, 4.000000, "Game Center", "wall");//continue
}
This is the problem when collide is destroyed and the soldier has already stopped than there is no way to continue(not in my code),
When I tried to check if soldier is colliding with drawActor game started to act weird
I would appreciate any help or suggestions on how to implement this, this is a game based on tower defense but here you can send soldiers to fight in the path