using UnityEngine; using System.Collections; public class TyroneController : MonoBehaviour { public float maxSpeed = 10f; bool facingRight = true; Rigidbody2D myRigidbody2D; void Start (){ myRigidbody2D = this.GetComponent<Rigidbody2D>(); } void FixedUpdate () { float move = Input.GetAxis ("Horizontal"); //expected ; myRigidbody2D.velocity = new Vector2( move * maxSpeed, myRigidbody2D.velocity.y); if (move > 0 &&!facingRight) Flip (); else if (move < 0 && facingRight) Flip (); } void Flip () { facingRight = !facingRight; Vector3 theScale = transform.localScale; theScale.x *= -1; //invalid expression term "=" transform.localScale = theScale; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)