receiveDamage method
Implementation
void receiveDamage(double damage, dynamic from) {
if (life > 0) {
life -= damage;
}
if (life <= 0) {
die();
}
}
void receiveDamage(double damage, dynamic from) {
if (life > 0) {
life -= damage;
}
if (life <= 0) {
die();
}
}