How to do combos?

Hi,
I have seen this on the wiki that could help me to do a combo: unifycommunity.com
But I don’t know how classes are used, I mean, I need to attach KeyCombo.js to any object? Or just having it on my project?

I want to achieve the following, on my game there are this next keys: Directions, Shoot, Attack and Jump
I want my character to do different attacks basing on the direction pressed ej: attack+up a vertical attack and attack+left horizontal attack.

Hope you could help me, thanks.

You don’t attach KeyCombo to any object. You create another script instead, see the below one in your link. I’ll include it here for ease.

Add this code to your player script, or add it to your player object as a separate script:

// Two sample combos:

private var falconPunch : KeyCombo = KeyCombo(["down","right","right"]);
private var falconKick : KeyCombo = KeyCombo(["down", "right", "Fire1"]);

function Update()
{
    if (falconPunch.Check())
    {
        // do the falcon punch
        // Replace this code with your own implementation
        Debug.Log("PUNCH"); 
    }
    if (falconKick.Check())
    {
        // do the falcon kick
        // Replace this code with your own implementation
        Debug.Log("KICK");
    }
}

Good luck!