using UnityEngine;
using System.Collections;
public class PlayerKeyboard : MonoBehaviour {
public float speed = 8f;
public float maxVelocity = 4f;
[SerializeField]
private Rigidbody2D myBody;
private Animator anim;
void Awake(){
myBody = GetComponent<Rigidbody2D> ();
anim = GetComponent<Animator> ();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate () {
PlayerKeyboard ();
}
void PlayerMoveKeyboard(){
float forceX = 0f;
float vel = Mathf.Abs (myBody.velocity.x);
float h = Input.GetAxisRaw ("Horizontal");
if (h > 0) {
if (vel < maxVelocity)
forceX = speed;
} else if (h < 0) {
if (vel < maxVelocity)
forceX = -speed;
}
myBody.AddForce(new Vector2 (forceX,0));
}
}
Assets/Scripts/PlayerKeyboard.cs(25,17): error CS0119: Expression denotes a type', where a
variable’, value' or
method group’ was expected
Unity3D v5.3.6f1. Thanks you!!!