Page 1 of 1

Collision whit "any actor" is possible?

PostPosted: Sun Mar 09, 2008 6:32 pm
by equinox
Hi,

in draw->i use this code:

int n;
double mindist = 10000; //Initialize min distance with some high value

Actor *actors, *closest = NULL,*ACT;

//Get all actors that collides with the sensor actor
actors = getAllActorsInCollision("Event Actor", &n);
if(actors){
int i;
for(i = 0; i < n; i++){
if(strcmp(actors[i].name, "player") != 0){ //Ignore the player actor
double d = distance(player.x, player.y, actors[i].x, actors[i].y);
if(d < mindist){
closest = (actors + i);
if(strcmp(actors[i].clonename, "ENEMY") == 1){
strcpy(ID44.stringvar,actors[i].clonename);
ACT = getclone(actors[i].clonename);
ACT->HP = 1;
}
}
}
}
}
...it wotk. Well, but is possible change-> if(strcmp(actors[i].clonename, "ENEMY") == 1) with "any actor" in the game, this way' I can collide with any actores in game and to remove from them hp?

Tnk1000 for help.

Re: Collision whit "any actor" is possible?

PostPosted: Sun Mar 09, 2008 8:10 pm
by makslane
Is better put this code in a Collision event with any actor.