i have a problem with my script. im making a tower defence game but i got a problem with life of the monster…
target2 is a gameobject(my cannonball) monsterPos i my monsters position(vector3)
point1 is Cannonball start position.
Life is my monsters life.(int = 200).
TowerCannonStats is my cannons damage (int = 50).
the problem is.i need TowerCannonStats only take 50 from Life. but it take 50 again and again. 1000000 times Each sec… how to i say it only shell do it one time…
This way it does it only 1x as long as the object lives.
If you want another behaviour I need more infos how often the Game shall damage the target.
HtH
regards
var Monster : Transform;
var MonsterPos : Vector3;
var point1 : Vector3;
var target : TowerStats;
var target2 : GameObject;
var target1 :move;
var duration :float = 100.0;
private var startTime : float;
var speed = 6.0;
var Delay = 15.0;
var i;
function Start () {
while (true) {
i = Mathf.Repeat(Time.time * speed, Delay);
yield;
}
}