Page 1 of 1

if(... || ...) not work!!

PostPosted: Sat Mar 07, 2009 11:06 am
by equinox
Hi at ALL,

if I write
if(strcmp(actors[i].name, "player") != 0 ){ //Ignore the player actor

but
if(strcmp(actors[i].name, "player") != 0 || strcmp(actors[i].name, "DRAW") != 0){ //Ignore the player actor and DRAW actor

not work.

Question: WHY?

where am I wrong?

I wish that the collision ignore the 2 ACTORS.

if collide with these 2, does not enter into "if(...||...)

Tnk1000 for help.

Re: if(... || ...) not work!!

PostPosted: Sat Mar 07, 2009 1:34 pm
by makslane
You must not use OR in this case. Use AND!

Code: Select all
if(strcmp(actors[i].name, "player") != 0 && strcmp(actors[i].name, "DRAW") != 0) //Ignore the player actor and DRAW actor
{

}