I'm making a survival game and i need scripts for enemy movement, spawning, and to make them die when they get shot any help? (using new version of unity)
Randomguy1273,
I don't sugest you ask for script, as people tend to disregard it... I suggest you google "Unity 3D AI" or "Unity 3D Path". Then if I didn't like This or This you should search around on the forums for what you need... If you can't find an answer, then you need to be creative, and at least try... I (and lots of other people) will help you later, if you at least try to help yourself
Well enemies is one of the most difficult parts of a game, I reccomend you watching this tutorial:
http://www.youtube.com/user/TornadoTwins#p/u/48/u8t3fdKhDxg
This tutorial will show you how to create turrets.
Good Luck Randomguy.
yeah, i have been trying to. I cant seem to get it to work…
I’d help if i could.
Maybe you should try this script:
var distance;
var target : Transform;
var lookAtDistance = 15.0;
var attackRange = 10.0;
var moveSpeed = 5.0;
var damping = 6.0;
private var isItAttacking = false;
function Update ()
{
distance = Vector3.Distance(target.position, transform.position);
if(distance < lookAtDistance)
{
isItAttacking = false;
renderer.material.color = Color.yellow;
lookAt ();
}
if(distance > lookAtDistance)
{
renderer.material.color = Color.green;
}
if(distance < attackRange)
{
attack ();
}
if(isItAttacking)
{
renderer.material.color = Color.red;
}
}
function lookAt ()
{
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
}
function attack ()
{
isItAttacking = true;
renderer.material.color = Color.red;
transform.Translate(Vector3.forward * moveSpeed *Time.deltaTime);
}