Advertisement
333GameStudio

Enemy health (barrels) (js)

Mar 20th, 2015
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #pragma strict
  2.  
  3. var Health = 100;
  4. var Effect : Transform;
  5.  
  6.  
  7.  
  8. function ApplyDammage (TheDammage : int)
  9. {
  10. Health -= TheDammage;
  11.  
  12. if(Health <= 0)
  13. {
  14. Dead();
  15. }
  16. }
  17.  
  18. function Dead()
  19. {
  20.  
  21. var boom = Instantiate(Effect,transform.position,transform.rotation);
  22. Destroy(boom.gameObject,2);
  23. Destroy (gameObject);
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement