Actor response after touching 3 other actors

A student is creating a game where a tree hides and opens up to a path after touching 3 squirrels. What programming do they use to track that they have touched the 3 squirrels?

There are a lot of possible ways to track this.
I suggest that you create a global variable for each squirrel the tree needs to touch.

  • touchedSquirrel1
  • touchedSquirrel2
  • touchedSquirrel3

You should reset their values to 0 or false when the project is stopped.

When you detect that a certain squirrel has touched the tree, you’ll set the appropriate variable to 1 or true.
That code might look something like this:

Finally have the tree check that all three of variables have been set to “true”, and you’ll know that the tree touched all three squirrels.
That code might look something like this:

I hope this helps!
Kind Regards,
~Chris Murphy