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

Non-platform specific questions.

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

Postby equinox » Sat Mar 07, 2009 11:06 am

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

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

Postby makslane » Sat Mar 07, 2009 1:34 pm

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
{

}
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