- Home /
Question by
deluxe-paint · Jan 05, 2015 at 02:14 PM ·
triggereventsplaymakerkeys
Triggering an event after collecting key objects
This is must be a question for programmers with pacifiers.
So, I am finishing up the end of my little game level. and I have trigger objects and each trigger, enables key objects. So when I collect 6 keys, I want to trigger an event, which is "You Win!"
How can I do that with scripts or playmaker?
Thanks in advance.
Comment
Create a counter and add to it whenever you collect a key. When your counter reaches the total number of keys in the level, end the level.
Something like in the psuedo-code below:
int counter = 0;
void OnTriggerEnter()
{
counter++;
if(counter == 6)
{
// End the level and show "You Win".
}
}