Hi,
i'm setting up a dead method for my hero. I have this before the constructor:
This in the constructor:
The act method:
The dead method:
Problem is when I compile, Mario has the dead value set to true. How do I change it to false? I thought setting it with the constructor would do it? The sourcecode is available here: http://www.greenfoot.org/scenarios/8881
private boolean isDead;
isDead = false;
public void act()
{
if (isDead = false){
checkKeys();
boundary();
if(!checkGround())
{
fall();
}
else
{
isJumping = false;
}
}
else if (isDead = true){
dead();
}
} public void dead()
{
isDead = true;
Levels L = (Levels)getWorld();
Counter lifeCounter = L.getLifeCounter();
if (lifeCounter.getValue() <= 0)
{
getWorld().addObject(new Dead(), getX(),getY());
getWorld().removeObject(this);
}
}

