Collision whit "any actor" is possible?

Non-platform specific questions.

Collision whit "any actor" is possible?

Postby equinox » Sun Mar 09, 2008 6:32 pm

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.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: Collision whit "any actor" is possible?

Postby makslane » Sun Mar 09, 2008 8:10 pm

Is better put this code in a Collision event with any actor.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron