This site requires JavaScript, please enable it in your browser!
Greenfoot back
BrianOK
BrianOK wrote ...

2017/4/27

how to stop this code when my actor dies

BrianOK BrianOK

2017/4/27

#
i have found a problem...
int score = 0;
    /**
     * Act - do whatever the Counter wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        setImage(new GreenfootImage("Score : " + score,60, Color.GREEN, Color.YELLOW));
        addScore();
    } 
     
    public void addScore()
    {
        score++;
    }
this code is a timer, which i need it to stop when my actor dies. i've tried greenfoot.stop but it takes away the purpose of restarting. i need a code that will stop the timer but not the game when my actor dies
danpost danpost

2017/4/27

#
Need to see all the codes from where 'addScore' is being called from.
You need to login to post a reply.