Ok so I want to be able to make my player print text, First i want to be able to do it with a key input, and then I want to be able to do it when he collides with an A.I player, this is my code so far
using UnityEngine;
using System.Collections;
public class robot : MonoBehaviour
{
public float maxSpeed = 10f;
bool fasingRite = true;
Animator anim;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
void FixedUpdate ()
{
float move = Input.GetAxis ("Horizontal");
anim.SetFloat ("speed", Mathf.Abs (move));
rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);
if (move < 0 &&!fasingRite)
Flip ();
else if(move > 0 && fasingRite)
Flip ();
}
void Flip ()
{
fasingRite = !fasingRite;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
}