- Home /
This question was
closed May 13, 2013 at 04:37 PM by
Fattie for the following reason:
Problem is not reproducible or outdated
Question by
gigica04 · May 13, 2013 at 04:21 PM ·
javascriptraycastraycasthitclick
When I click, my enemy doesnt lose health...
if(playerDistance <= 81){
if(!attacking){
Invoke("ApplyDamage", 3);
attacking= true;
}
if(takeDamage){
var hit : RaycastHit;
if(Input.GetMouseButtonDown(0)){
if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit, 200)){
if(hit.collider== Harakiri){
health --;
}
}
}
}
}
var Harakiri : GameObject;
var health =3;
var takeDamage : boolean;
var playerDistance : int;
var attacking: boolean;
playerDistance = Vector3.Distance(Player.transform.position, transform.position);
I get no console error and no run error, but when I click, the enemy doesnt receive damage!!!!
Comment
add many Debug.Log("I am here") lines to quickly find the problem
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Raycasting2D please help 1 Answer
Switch GameObjects Tags with javascript 1 Answer
Need help with script to find and persue target on click. 1 Answer
Make tranform follow raycast 1 Answer