Quantcast
Channel: Questions in topic: "follow"
Viewing all articles
Browse latest Browse all 536

Character always follow straight help!!!

$
0
0
Hi there so i have a character.. and i would like him to always to be drawn to the middle with his face forward.. like the one you see.. but when i get it to spawn.. it always follows with the wrong side.. and turns in the wrong way: ![alt text][1] [1]: /storage/temp/51253-screen-shot-2015-07-29-at-60415-pm.png Here is the Code for the object if that helps: using UnityEngine; using System.Collections; public class EnemyScript : MonoBehaviour { public float moveSpeed = 3; public int health; private GameObject scoreObject; private Transform track; //private ScoreScript scoreScript; void Awake () { //scoreScript = GetComponent(); scoreObject = GameObject.Find ("Score"); } void Start () { track = GameObject.Find ("Center").transform; } void Update () { float move = moveSpeed * Time.deltaTime; transform.position = Vector3.MoveTowards (transform.position, track.position, move); } void OnMouseDown() { health = + -1; if (health <=0) { scoreObject.GetComponent().AddScore(); Destroy(gameObject); } } void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "Player") { Destroy(col.gameObject); } } }

Viewing all articles
Browse latest Browse all 536

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>