using System.Collections;
using UnityEngine;
public class ControllerScript : MonoBehaviour {
public float maxSpeed = 10f;
bool facingRight = true;
void Start () {
}
void FixedUpdate () {
float move = Input.GetAxis("Horizontal");
Rigidbody2D myRigidbody = GetComponent().velocity.y;
if (move > 0 &&!facingRight)
Flip ();
else if (move < 0 && facingRight)
Flip ();
}
void Flip()
{
facingRight = !facingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
}
im watching at the moment a tutorial about animations. But im getting this error:
Assets/Scripts/ControllerScript.cs(17,72): error CS0029: Cannot implicitly convert type `float' to `UnityEngine.Rigidbody2D'
HEEEEEELP!
↧