Advertisement
iUnkreativ

PlayerController.cs Error CS 1061 (Unity 5)

Jul 23rd, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PlayerController : MonoBehaviour {
  5.  
  6.  
  7.     public float maxSpeed = 4;
  8.     public float jumpForce = 550;
  9.     [HideInInspector]
  10.     public bool lookingRight = true;
  11.  
  12.     private Rigidbody2D rb2d;
  13.     private Animator anim;
  14.  
  15.     void Start () {
  16.         rb2d = GetComponent<Rigidbody2D>();
  17.         anim = GetComponent<Animator>();
  18.     }
  19.  
  20.     void FixedUpdate ()
  21.     {
  22.         float hor = Input.GetAxis ("Horizontal");
  23.  
  24.         rb2d.velocity = new Vector2 (hor * maxSpeed, rb2d.velocity.y);
  25.  
  26.         if ((hor > 0 && !lookingRight) || (hor < 0 && lookingRight))
  27.             Flip ();
  28.     }
  29.  
  30.     public void Flip()
  31.     {
  32.         lookingRight = !lookingRight;
  33.         Vector3 myScale = transform.localeScale;
  34.         myScale.x*= -1;
  35.         transform.localeScale = myScale;
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement