Translate

sábado, 18 de marzo de 2017

I little bit update on Parabolic shot of my "Tower Defense Basic Pixel Art Pack"

I have improved the arrows parabolic shot, anyway i will include it in the next update but meanwhile you have the code that you must to change on "/Scripts/Archers_Tower/Parabolic_shot_Controller.cs"

*Replace the functions content:

.........
.........

void OnTriggerEnter2D(Collider2D coll) {

sw=false;
        GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static; //New Code
        GetComponent<Collider2D>().enabled=false;
this.transform.position = master.setThisZ(this.transform.position,0);
Invoke("onDestroy",1);
}
.........
.........

void isFalling(){//do when is falling

        if (this.transform.position.y < target.transform.position.y) {      //New Code
            GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
        }
float auxv = 0f;
float speedy = target.GetComponent<Rigidbody2D>().velocity.y;
float speedx = target.GetComponent<Rigidbody2D>().velocity.x;
if(Math.Sqrt(speedy*speedy)>Math.Sqrt(speedx*speedx)){
auxv=speedy;
}else{
auxv=speedx;
}
if(auxv<0){auxv = -auxv;}
if(accuracy_mode==1){
transform.position = Vector2.MoveTowards(transform.position, target.transform.position, Time.deltaTime*1);
}

find_error();//Not Hit Detection

}
.........


Tower Defense Basic Pixel Art Pack Unity Asset Store URL: http://u3d.as/jvw

No hay comentarios:

Publicar un comentario