There is the probleme:
-An object reference is required to access non-static member UnityEngine.Transform.Translate(UnityEngine.Vector3)' -An object reference is required to access non-static member
UnityEngine.Transform.eulerAngles’
Thx for you help
using UnityEngine;
using System.Collections;
public class bonhommecontrole : MonoBehaviour
{
public Animator anim;
public float speed = 8f;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator> ();
}
// Update is called once per frame
void Update ()
{
float x = Input.GetAxis ("Horizontal");
anim.SetFloat ("speed", Mathf.Abs (x));
if (x > 0) {
Transform.Translate (x * speed * Time.deltaTime, 0, 0);
Transform.eulerAngles = new Vector2 (0, 0);
}
if (x < 0) {
Transform.Translate (-x * speed * Time.deltaTime, 0, 0);
Transform.eulerAngles = new Vector2 (0, 180);