/* * Start is called before the first frame update */ void Start() { //initializes all of the variables that are used during execution player_script = player.GetComponent <Player_Script>(); penguin = GetComponent <Rigidbody>(); game_runner_script = FindObjectOfType <Game_Runner>(); animator = gameObject.GetComponent <Animator>(); penguin_collider = penguin.GetComponent <Collider>(); penguin.useGravity = true; penguin.isKinematic = false; max_velocity = 4.0f; has_collided_with_player = false; direction = ""; is_in_pen = false; sliding_back = false; penguin_switch_num = 4; //randomly decides which direction the penguin is facing at start int rand_walk = Random.Range(0, 1); if (rand_walk == 0) { animator.Play("walk_left"); } else { animator.Play("walk_right"); } }
// Start is called before the first frame update void Start() { //initializes all of the variables that are used during execution player_script = player.GetComponent <Player_Script>(); penguin = GetComponent <Rigidbody>(); anim = gameObject.GetComponent <Animation>(); game_runner_script = FindObjectOfType <Game_Runner>(); animator = gameObject.GetComponent <Animator>(); penguin_collider = penguin.GetComponent <Collider>(); penguin.useGravity = true; penguin.isKinematic = false; max_velocity = 10.0f; has_collided_with_player = false; }