Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How to make enemys do damage and you dying etc

$
0
0
So I have a zombie arcade game in 3d, zombies can die, i do dmage, they fallow me, alls good. I Besides I need the zeds to be able to kill me as in 4 hits to me ends the game and switches to a GAME OVER scene. doesnt sound too complicated but ive been stuggling with this for the past 2 weeks. Also I would like if on each of the 4 hits blood goes on the screen and it gets redder (like in cod haha). Thanks anyone who helps! Heres my EnemyController Script: using UnityEngine; using System.Collections; using UnityEngine.AI; public class EnemyController : MonoBehaviour { NavMeshAgent nav; Transform player; Animator Controller; // Use this for initialization void Awake () { nav = GetComponent (); player = GameObject.FindGameObjectWithTag ("Player").transform; Controller = GetComponentInParent (); } // Update is called once per frame void Update () { nav.SetDestination (player.position); Controller.SetFloat ("speed", Mathf.Abs (nav.velocity.x + nav.velocity.z)); } } HERES MY GAME MANAGMENT SCRIPT IF YOU MAY NEED IT? using System.Collections; using UnityEngine; public class GameManagment : MonoBehaviour { public int round = 1; int zombiesInRound = 10000000; int zombiesSpawnedInRound = 0; float zombieSpawnTimer = 0; public Transform[] zombieSpawnPoints; public GameObject zombieEnemy; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (zombiesSpawnedInRound < zombiesInRound) { if (zombieSpawnTimer > 2.1) { SpawnZombie (); zombieSpawnTimer = 0; } else { zombieSpawnTimer += Time.deltaTime; } } } void SpawnZombie() { Vector3 randomSpawnPoint = zombieSpawnPoints [Random.Range (0, zombieSpawnPoints.Length)].position; Instantiate(zombieEnemy, randomSpawnPoint, Quaternion.identity); zombiesSpawnedInRound++; } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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