+ 1
Why is this Object Method not working properly? SOLVED
https://code.sololearn.com/cVGIZho3sKMK/?ref=app Im attempting to have it return a true or false depending on if a object meets a certain integer criteria. I am completly lost. Nothing i try works. Please help me.
5 odpowiedzi
+ 2
Monody
Change your constructor
public Enemy(int range, int damage, int health, int speed)
{
this.range = range;
this.damage = damage;
this.health = health;
this.speed = speed;
}
+ 1
Monody
Remove semicolon after if condition
or no need to write if else just do this:
return (health >= 30);
------
public bool IsMiniboss() {
return health >= 30;
}
+ 1
A͢J
Ok so i did the second option, and although the errors went away, it always return false even if the value is 30 or above.
https://code.sololearn.com/cQ42wMhQ6HVR/?ref=app
+ 1
A͢J Thank you very much! it works as intended now!
0
I modified it to look like that and it gave me even more errors.
https://code.sololearn.com/cQ42wMhQ6HVR/?ref=app