[TUTORIAL] Fighting Game Part 2 (Remake) | Unity3D

Channel: Mr.Game Development God

7,112

TIP: Right-click and select "Save link as.." to download video

Initializing link download... Initializing link download.....

SCRIPTS:
(PlayerState and Die scripts are in the comment section)

MoveObject (place on character):

function Update(){


if( Input.GetKey(KeyCode.RightArrow)){
transform.Translate(Vector3.forward * Time.deltaTime *-5);
}

if( Input.GetKey(KeyCode.LeftArrow)){
transform.Translate(Vector3.forward * Time.deltaTime *5);
}

}




Raycast (place in cube inside the character) :

static var distance1 : float = 5;


function Update () {


var hit: RaycastHit;
Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward),hit);
distance1 = hit.distance;


}

NOTE (PlayerState) : If you don't have animations, remove "anim = GetComponent.SMALLERAnimationGREATER();"
and replace "yield WaitForSeconds(anim["SpinKick"].length/2); " with "yield WaitForSeconds(0.5); or any number.