- Home /
Player taking damage on collision. Can't get the script to work!?
var health = 50; var damage = 10; var Die = 0;
function ApplyDamage (damage : int) { health -= damage;
if(health <= 0) {
Die();
}
function Die(); { //Die and or Respawn }; }
Error: Assets/Player.js(12,10): BCE0044: expecting (, found 'Die'.
Comment
Please note that this is only the script for the player! (So that the player may take damage and eventually die.)
Best Answer
Answer by BiG · Nov 13, 2012 at 08:29 AM
Seems like you are "encapsulating" the function Die() inside ApplyDamage()...Obviously that's not correct. It should be
function ApplyDamage(...){
//...
}
function Die(){
//...
}
Your answer
Follow this Question
Related Questions
Respawn Player after Health 0 1 Answer
Weapon Mesh Damage 1 Answer
how to take health/hearth from player when colliding with an object? 2 Answers
Dying Problem! 1 Answer
bullet damage problem 1 Answer