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

This Script don't work, Why? / Life players

$
0
0
I have this script: #pragma strict var lives = 3; var livesTexture : Texture2D[]; var livesTextureSize = 30; function OnGUI () { var livesTextureRect = Rect(10,5,livesTextureSize,livesTextureSize); for (var i : int = 0; i < lives; i++) { GUI.DrawTexture(livesTextureRect,livesTexture[i], ScaleMode.ScaleToFit, true, 0.0f); livesTextureRect.x += livesTextureSize + 10; } } function OnTriggerEnter (myTrigger : Collider) { if(myTrigger.gameObject.name == "Enemy") { print("work?"); if (lives-1 >= 0) livesTexture[lives-1] = null; WaitForSeconds(2); Invoke("life", 2); } } function life() { Invoke("life2", 2); lives --; } function life2() { Invoke("life3", 2); lives --; } function life3() { lives --; print("YOU DEAD"); } When I enter a trigger for tag "enemy" in general does not detect it. No shows "print (" work ");" What is wrong? Script added to the First person controller. The enemy has the tag "Enemy"

Viewing all articles
Browse latest Browse all 1488

Latest Images

Trending Articles



Latest Images

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