- Home /
Activate trigger if items colected
Hi, first of all forgive my poor english (not a native speaker),
I have a very limited knowledge of scripting and can´t figure out how to solve my problem.
I need a trigger to be activated if the player collects 3 items (GameObjects), if the player hit the trigger before collecting all the 3 items he gets a "level Fail" message and restart the level. And obv I have no Idea how to set this up.
example: If the player (3rd person) colect all 3 items he will be able to move to the next level once he collide with the trigger at the end of the current level.
Anybody can help me out here??
thanks in advance ;)
Answer by syclamoth · Sep 16, 2011 at 04:22 AM
How about this- for each type of item, have a boolean value on your player script which switches to 'true' when the playe picks it up- then when you reach the end of level trigger, check like this-
if(itemOne && itemTwo && itemThree)
{
// WIN!!
} else {
// Lose and then reset
}
Thanks mate, used a logic very similar to this one u pointed out
Your answer
Follow this Question
Related Questions
Ignore collisions with self but still trigger with self 2 Answers
get only one colliding body 3 Answers
Multiple triggers/collisions 1 Answer