Hi! I’m very new to using this software and finally got the chance my fangame! Basically it’s a Rayman fangame with elements from DKC (such as bonus room minigames, being able to toss your partner to reach higher areas, etc. Now, here’s where people may start scratching heads.
Rayman’s partner in this game is my Rayman character (who is his girlfriend lmao), the two will have to help each other out if they wanna rescue Globox.
Anyways, does anybody know how a tag-team mechanic would work here? Basically in the DKC games, the second Kong always follows behind the Kong in front, copying their every move.
And like in the DKC games, you’re able to swap between Rayman or his girlfriend at any time, kinda like in this GIF.
If anybody is willing to help me, that’d be greatly appreciated!!
Hello, be sure to check out and understand the Platformer Tutorial before exploring more complicated mechanics:
If you already understand how to create a platformer game then to create a tag-team mechanic you can create two Platformer objects, for example Donkey and Diddy.
Then create a variable called CurrentPlayer set it to 1. For your Logic 1 will be Donkey, and Two will be Diddy.
Then add some logic that when you press the 1 key change the CurrentPlayer to 1, and when you press the 2 key change the CurrentPlayer to 2.
Do a TriggerOnce Condition for CurrentPlayer = 1 where you disable the platformer behavior on Diddy and enable the platformer behavior on Donkey.
Do a TriggerOnce Condition for CurrentPlayer = 2 where you disable the platformer behavior on Donkey and enable the platformer behavior on Diddy.
You will probably also want to add logic for when “Platformer behavior is disabled” on each to have them follow instead of being left behind.
You will also want to make sure your camera knows which player to follow.
Thank you, sir or ma’am! I appreciate it!
Problem solving 101:
Let’s first break up the problem. Then break it down more. A tag team seem to be two things: Following another character and switching between characters.
First part of the mechanic: Switching
There are two characters that behave differently, so there are two objects, one for each character.
They need to not be always able to walk. How are they walking? Potential solution: Platformer behavior. How are they prevented from walking? Potential solution: Disabling the platformer behavior. Only one should be able to walk at the beginning: turn off the behavior on the one that is following by default at the beginning of the scene.
They should be unable to move while switching, and unable to switch while switching. They should have an animation when switching. How do we achieve that? Potential solution: employ an FSM with the states “following”, “switching” and “leading”, which are self explanatory. Other potential solution that doesn’t involve learning what an FSM is: disable the platformer behavior when initiating the switch and reenable it once the animation is finished.
That goes in pair with 2: the behavior shouldn’t be enabled on a character that is following the player. So: only reenable it on the now controlled character once the animation is done.
Create the two character objects with the platformer behavior
Disable the behavior at the beginning of the scene for one object.
When the switch key is pressed, disable both behaviors and play the going back or going forward animation depending on whether it is following or leading. Once the animation is finished, turn on the behavior on the one whose animation was the going forward one.
Now for following, same thing, break up the problem into smaller ones and think logically to find what you need to do.
The character that follows needs to know where it is supposed to go. This can be the leader’s position. You probably want it to be behind the character and not on them though. You probably will want to make a leader’s point on the sprites for the other to go to when following.
The following character needs to go to that point on the leading character. It can’t go there directly though. Solution: keep track of the last X (5? 10? 50?) Positions of that point and set the position to the oldest one stored. How does one store a list easily and effectively? An array variable. How do I store the current position of the point in the array? Solution: put the x and y point positions in a temporary structure variable, and use the append variable action to put it at the end of the list. How do I get the oldest position? The newest one is added at the end of the array, so the start position, the index 0, contains the structure with the x and y positions of the oldest recorded position. How do you delete the oldest position after putting the following character at that position? The action remove array child at index with index 0 will remove the oldest entry.
Use the broken down problems with obvious solutions to piece your complete mechanic together.
Noted! Thanks for the info!