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

2014/6/27

can't find MyWorld

1
2
Svek Svek

2014/6/28

#
omg getting crazy of this. Sorry for all the questions but now it sais "missing return statement" om this code:
  public Counter getScore()
    {
        ScoreCounter = new Counter("Score");
        addObject(ScoreCounter, 60, 30);
    }
Svek Svek

2014/6/28

#
What to do?
danpost danpost

2014/6/28

#
Please... I said that the 'public Counter getScore' method was fine. Please change it back and put lines 3 and 4 of your last code post in your 'public SpaceWorld()' constructor.
Svek Svek

2014/6/29

#
but is i do that ScoreCounter = new Counter(); is an unreachable statement
  public Counter getScore()
    {
      return ScoreCounter;   
      ScoreCounter = new Counter("Score");
      addObject(ScoreCounter, 60, 30);  
    }
danpost danpost

2014/6/29

#
Remove lines 4 and 5 from the method. They do not go there. They belong in your world constructor.
Svek Svek

2014/6/30

#
Thanks it worked!! srry for the slow realization didn't really got it, but now i understand
Svek Svek

2014/6/30

#
How can u reset the timer btw?
danpost danpost

2014/6/30

#
Svek wrote...
How can u reset the timer btw?
I have no idea what you are referring to.
Svek Svek

2014/6/30

#
If the you lost the game how can u set the timer back to zero because if you play my game and you lost u can click a button with restart on it but the timer wil still be on the score of the game before
danpost danpost

2014/6/30

#
You should have the button start the world afresh ('Greenfoot.setWorld(new SpaceWorld());').
Svek Svek

2014/6/30

#
okay thanks
You need to login to post a reply.
1
2