;

PDA

Click to See Complete Forum and Search --> : Collision with two objects


marinebro0306
07-26-2005, 10:43 PM
I'm very new to 3DFA, and I know how to do collision. But, how do I do collision between 1 thing I am controlling and two things I want to avoid? The thing I am controlling is called circle, and the two others are square and square2.
My script:
if (circle.collideRect (square || square2)){
loser.show()
}
if (!(circle.collideRect (square || square2))){
loser.hide()
}

Loser is the message.
Help please!

ppedz
07-27-2005, 03:22 PM
From what you described it sounds like all you want to do is:

if (circle.collideRect (square) || circle.collideRect (square2)){
loser.show()
}else{
loser.hide()
}

Assuming that element loser is already hidden I would even skip the "else" part of this statement.

blanius
07-27-2005, 10:25 PM
Almost because if you collide and want the message to re-hide when they no longer collide you do need it.

ppedz
07-28-2005, 12:06 AM
:o Yes, makes sense when you put it that way.