- Home /
Question by
Oobi23 · May 12, 2015 at 06:38 PM ·
scoredestroy object
Change Score / On Click Destroy Enemy
using UnityEngine;
using System.Collections;
public class move : MonoBehaviour {
public Transform track;
private float moveSpeed = 5;
void Update () {
float move = moveSpeed * Time.deltaTime;
transform.position = Vector3.MoveTowards (transform.position, track.position, move);
}
}
So that is the code I have re used on the appearing enemies and I need to add a bit of coding for the enemies to destroy on click.The score system is money and it remains the same if the insects are destroyed before they reach to the track point. but if they do the cash/score decreases.
So I would like to ask how I would go about it to add a click on destroy to the enemies and score system that decreases its total value on the enemies reaching the track location??
Any help would be greatly appreciated. Kindest Regards,
Comment
Answer by FortisVenaliter · May 12, 2015 at 06:46 PM
Here are some references to get you started. Try to code the system on your own, and if you have problems, open up a new question with the specific issue.