- Home /
Fighting combo attacks
Hello Unity3D i have a question about combo attacks.See i have been researching about how to make combos but i still dont get it.What im trying to understand is how is it really done like i do i need to add like crossfade to animation play or is it another way of do ing it?Sorry if this make no sense.it because im not sure how its really done but like i got something started already and i want to know if its correct
#pragma strict
var LastAttack: int = 0;
function Update(){
if(Input.GetMouseButton(0) && LastAttack == 0){
animation.Play("atk1");
yield WaitForSeconds(.3);
if(!Input.GetMouseButton(0)) {
LastAttack = 0;
}
else {
LastAttack = 1;
}
}
if(Input.GetMouseButton(0) && LastAttack == 1 ){
animation.Play("atk2");
yield WaitForSeconds(.4);
if(!Input.GetMouseButton(0)) {
LastAtk = 0;
}
else {
LastAtk = 2;
}
}
if(Input.GetMouseButton(0) && LastAttack == 2){
animation.Play("atk3");
yield WaitForSeconds(.3);
if(!Input.GetMouseButton(0)) {
LastAtk = 0;
}
else {
LastAtk = 0;
}
}
}
function CheckInput() {
yield WaitForSeconds(.3);
if(!Input.GetMouseButton(0)) {
LastAtk = 0;
}
else {
LastAtk = 1;
}
}
Also LastAttack is an unknown identifier.is it because im using js instead of cs?
I think you fell asleep while making your script and forgot your variable is called LastAttack :)
Answer by rezki · Jun 24, 2014 at 04:49 PM
var LastAttack : int;
function Start(){
Last Attack = 0;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613143243im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Animations Combo 0 Answers
Not identifying the collider? 2 Answers
Finish One Combo 1 Answer
A node in a childnode? 1 Answer
Make 2d Animation Scene 0 Answers