Clickteam Fusion 2.5

Clickteam Fusion 2.5

Not enough ratings
Combining alternative events using event groups: a point & click example
By Dimitri Cosmos
Sometimes, there is a need to combine events that exclude each other. Perhaps, it might seem self-explanatory for experienced game developers, but I had a hard time finding a detailed beginner-friendly tutorial on event groups. I still haven’t. Eventually my patience ran out and after numerous trial & error attempts I came to following conclusions.
   
Award
Favorite
Favorited
Unfavorite
The objects and the goal
Let’s take an example from my first game design attempt (after Chokobreak exercise, which is located under Help>Tutorial).
Let’s say, you have four animals: a mosquito, a dragonfly, a frog and a stork. Your goal is to create a food chain, using all four of these animals. The perfect way of accomplishing this task is following:
1. Dragonfly eats mosquito.
2. Frog eats dragonfly.
3. Stork eats frog.
And then there’s the alternative event, when:
4. Frog eats mosquito.
The problem
My first approach was to write separate events. It didn’t turn out well. Then I found out about event groups and my next approach was to create following groups of events (this is simplified, without extra actions that actually take place in the game):
Group 1 [Dragonfly eats mosquito]:
• IF User clicks with left button on [mosquito], THEN [mosquito] is picked (an action or list of actions according to your own taste);
• IF User clicks with right button on [dragonfly], THEN [mosquito] is destroyed.
Group 2 [Frog eats mosquito]:
• IF User clicks with left button on [mosquito], THEN [mosquito] is picked;
• IF User clicks with right button on [frog], THEN [mosquito] is destroyed.
Group 3 [Frog eats dragonfly]:
• IF User clicks with left button on [dragonfly], THEN [dragonfly] is picked;
• IF User clicks with right button on [frog], THEN [dragonfly] is destroyed.
Group 4 [Stork eats frog]:
• IF User clicks with left button on [frog], THEN [frog] is picked;
• IF User clicks with right button on [stork], THEN [frog] is destroyed.
This is the way how human mind understands these events. But the problem is that Fusion understands these events differently. When the program reads the events from top to down and from left to right, it does not interpret the groups as separate clusters of events. Since the player can click on objects in any order, it does not always lead to a result, we want. For example, with the groups in the current state, when the player right-clicks on the [frog], both the [mosquito] and the [dragonfly] are destroyed.
The solution
I tried to deactivate the alternative groups of events in the event lines, to create sort of triggers, but it didn’t turned out well either. The key to solution to this problem is to create a separate group for picking objects and triggering the groups mentioned above.

In the end, the Event Editor looks like this:
Group 0 [Animals are picked]
• IF User clicks with left button on [mosquito], THEN [mosquito] is picked AND Activate group 1 and 2 (under Special Conditions);
• IF User clicks with left button on [dragonfly], THEN [dragonfly] is picked AND Activate group 3;
• IF User clicks with left button on [frog], THEN [frog] is picked AND Activate group 4.
Group 1 [Dragonfly eats mosquito]:
• IF User clicks with right button on [dragonfly], THEN Deactivate Group 2 AND [mosquito] is destroyed.
Group 2 [Frog eats mosquito]:
• IF User clicks with right button on [frog], THEN Deactivate Group 1 AND [mosquito] is destroyed.
Group 3 [Frog eats dragonfly]:
• IF User clicks with right button on [frog], THEN [dragonfly] is destroyed.
Group 4 [Stork eats frog]:
• IF User clicks with right button on [stork], THEN [frog] is destroyed.

NB! When creating groups 1,2,3,4 untick "Active at the start of the frame"! (or, if you forgot to do that, right click on the group title and edit)

This accomplishes two things.
First, the player cannot longer right-click on objects, unless he has picked the corresponding object with the left-click. In other words, the player is obligated to pick food first and feed it to another animal afterwards. Although, the player can pick both the [mosquito] and [dragonfly] and feed it to the [frog] simultaneously, it’s not a problem in terms of gameplay.
Second, the alternative events are blocked. So, the player has limited interaction opportunities with the frame and there is no room for game exploitation anymore.
NB! It's a good idea to deactivate Group 2 again, if Group 1 is activated (and vice versa), because these two are alternative events and otherwise there might be problems later adding additional actions (like score).
Final words
I guess, in some cases an alternative method would be using flags as triggers and condition [Is a flag on?] (Under Alterable values > Flags), but in this particular example I couldn’t figure out how to apply it appropriately. And, as far as I understand, Fastloops allow to combine events, too, particularly, for animations, but I can’t imagine a way of using them for simple point & click actions as in the example.
If anyone knows alternative solutions for combining alternative events, please share your knowledge!