Whenever I see combo scripts they are mostly based on time, I haven't been able to fully grasp them as I'm still an amateur scripter, but I tried it with Triggers. It seams like it could work just fine, are there any reasons that I'm not aware of why this might be a bad idea? Here's the script.
function Attack() {
//play propper animation if attack is true, if next attack isn't triggered, go back to first attack.
if(attack1 == true) {
if(Input.GetButton("Jump")) {
animation.CrossFade("atk1");
yield WaitForSeconds(.4);
attack2 = true;
attack1 = false;
}
}
if(attack2 == true) {
if(Input.GetButton("Jump")){
animation.CrossFade("atk2");
yield WaitForSeconds(.5);
attack3 = true;
attack2 = false;
}
else{
yield WaitForSeconds(.3);
attack1 = true;
attack2 = false;
}
}
if(attack3 == true) {
if(Input.GetButton("Jump")){
animation.CrossFade("atk3");
yield WaitForSeconds(.5);
attack1 = true;
attack3 = false;
}
else{
yield WaitForSeconds(.3);
attack1 = true;
attack3= false;
}
}
}
asked
Mar 08 '11 at 07:16 PM
Wes 1
40
●
18
●
18
●
22
On first glance it would seem you execute a combo and continue doing it whether your attack connects with an enemy or not. If this is not a problem (because of points based on combo or something similar) it seems fine to me.