Hey there everyone!
As we're supposed to do a project for informatics over the holidays and I'm really stuck with a problem, I hope for your help.
For explaining: My game is based on a Spaceship being supposed to destroy some enemies. When all enemies are destroyed, I want the game to start kind of a "new level" with new enemies and stuff. Therefore, I wrote the following part in my Spaceship-act-method:
On this point I encountered the first problem as it said "Non-static method cannot be referenced from a static context". So I changed the "reachedNewLevel"-method in the world class to:
Well, now I get the same message, just for "getObjects", which obviously cannot be used in a static context. And... yeah. Well. What do I do now? Is my idea of letting the SpaceWorld delete all Objects and after that construct a new scenario even possible? If yes, how do I avoid this problem I have here? If no, is there another possible way?
Please apologize if it's a dumb question, we did not do this for too long. And also, English is not my first language, so maybe I've made some little mistakes...
Thank you! :)
if(SpaceWorld.enemyCounter == 0) { SpaceWorld.reachedNewLevel(); System.out.println("Next Level reached!"); }
public static void reachedNewLevel() { removeObjects(getObjects(null)); }