- Home /
Combo problems
So, im making a 2d game, and havying some trouble when i make a combo
public comboSystem rockR = new comboSystem (new KeyCode[] {KeyCode.DownArrow,KeyCode.RightArrow,KeyCode.Z}); //the combo movement
if(rockR.check() && estaNoChao) //verifies if the right keys was pressed and the player is in the ground
{
animator.SetTrigger("atacou"); //set the trigger that initiate the animation
Instantiate(atack, spawner.transform.position, spawner.transform.rotation); //throw the rock
}
and this only check if the player hit the right keys, in a minimun time to make a special moviment. This part are OK. My problem is when i hit downArrow he crouch, or the RightArrow he goes to right. I wanted to make a delay so he can hit the combo without moving the character. (like in mortal kombat you go down,up,puch he dont go down and jump, and them make the move). Get the ideia ? have you some helpfull insight ? Thank you
This is a general question about processing input. Executing "combo" moves is typically handled through a more fully-featured input processing method. Check out my answer in this thread:
http://answers.unity3d.com/questions/935288/letting-the-game-decide-whether-to-use-getbutton-o.html
By keeping a record of how long each control has been pressed, (the "timeHeld" variable in that answer) you can choose to respond to inputs (like moving, crouching) only after a short delay. You can detect combos during (and after) this delay. A delay between 0.2 and 0.3 seconds should suffice without making the game feel "sluggish".