In my game im trying to grab the value of the current score value from the class score to generate a new level. I keep getting the error, "non-static method getValue() cannot be referenced from a static context". This occurs on line 5. I know it's probrably a really easy fix, but I've forgotten how to do it :(
Code from world class (SSGame):
Code from Score class:
public void showScore(int delay) { if (currentlevel <= 3) { addObject(new Message("You've stopped them... for now.\nScore:" + Score.getValue()), getWidth()/2, getHeight()/2); Greenfoot.delay(delay); addObject(new Message("Get ready for level " + currentlevel + "!"), getWidth()/2, getHeight()/2); Greenfoot.delay(delay); Music.stop(); Greenfoot.setWorld(new SSGame(currentlevel, Score.getValue())); } else { addObject(new Message("You stopped the alien invation! \nReturning you back to the main menu..\n Try out another game!\nFinal Score: " +score.getValue()), getWidth()/2, getHeight()/2); Music.stop(); Win.play(); Greenfoot.delay(delay*2); Greenfoot.setWorld(new Menu()); } }
public int getValue() { return value; }