I have a big problem.
Basically, my game Trash Pokemon, when played on the greenfoot website, works well in the menu, but won't manage to set the main world after clicking on the "new game" button (it will stop the game and show a black screen), although it works super well on the greenfoot software. I have no idea why this is happening.
Things I changed since last time when it worked :
I made so that all objects come from the same classes, only the image, some variables and the collision changing with the constructor.
Example : before, I had one class for every object like the sign, the flowerpot, the chair... etc, and now I'm only using specific classes (ObjectBasic, for objects without collision, ObjectSimple, for objects with a collision, ObjectText, for objects that display some text, and I did the same with my NPCs, there are 2 main classes : ObjectNPC and ObjectNPCItem. Some objects with special properties still use their own classes though.) and they have constructors with some parameters like "String object" for example, that directly sets the object's image in the constructor when created.
Here is the code of ObjectSimple, to give an example :
I thought that the fact that the classes had no base images would cause the crash, so I put a base image on all classes, but it did not work.
I also cleaned the code of a lot of classes, but I don't think this has a lot to do with the problem, as it was simple things like changing "time = time + 1" to "time++" for example.
I really need help to understand what's happening
import greenfoot.*; public class ObjectSimple extends WorldObjects { GreenfootImage centerTable = new GreenfootImage("/Objects/Simple/CenterTable.png"); GreenfootImage houseTable = new GreenfootImage("/Objects/Simple/HouseTable.png"); GreenfootImage flowerPot = new GreenfootImage("/Objects/Simple/FlowerPot.png"); GreenfootImage houseSink = new GreenfootImage("/Objects/Simple/HouseSink.png"); GreenfootImage chairLeft = new GreenfootImage("/Objects/Simple/ChairLeft.png"); GreenfootImage chairRight = new GreenfootImage("/Objects/Simple/ChairRight.png"); GreenfootImage bookShelf = new GreenfootImage("/Objects/Simple/BookShelf.png"); GreenfootImage wallBackHouse = new GreenfootImage("/Objects/Simple/WallBackHouse.png"); GreenfootImage wallBackCenter = new GreenfootImage("/Objects/Simple/WallBackCenter.png"); GreenfootImage tree = new GreenfootImage("/Objects/Simple/Tree.png"); GreenfootImage treeBottom = new GreenfootImage("/Objects/Simple/TreeBottom.png"); GreenfootImage treeLine6 = new GreenfootImage("/Objects/Simple/TreeLine6.png"); GreenfootImage buildCenterUp = new GreenfootImage("/Objects/Builds/CenterPokemon/CenterUp.png"); GreenfootImage buildCenterLeft = new GreenfootImage("/Objects/Builds/CenterPokemon/CenterLeft.png"); GreenfootImage buildCenterRight = new GreenfootImage("/Objects/Builds/CenterPokemon/CenterRight.png"); GreenfootImage buildHomePlayerUp = new GreenfootImage("/Objects/Builds/HomePlayer/HomePlayerUp.png"); GreenfootImage buildHomePlayerLeft = new GreenfootImage("/Objects/Builds/HomePlayer/HomePlayerLeft.png"); GreenfootImage buildHomePlayerRight = new GreenfootImage("/Objects/Builds/HomePlayer/HomePlayerRight.png"); public ObjectSimple(String object) { if(object == "centerTable") { setImage(centerTable); objectCenter = 25; } if(object == "houseTable") { setImage(houseTable); objectCenter = 27; } if(object == "flowerPot") { setImage(flowerPot); objectCenter = 25; } if(object == "houseSink") { setImage(houseSink); objectCenter = 20; } if(object == "chairLeft") { setImage(chairLeft); objectCenter = 15; } if(object == "chairRight") { setImage(chairRight); objectCenter = 15; } if(object == "bookShelf") { setImage(bookShelf); objectCenter = 25; } if(object == "tree") { setImage(tree); objectCenter = 50; } if(object == "treeBottom") { setImage(treeBottom); objectCenter = 50; } if(object == "treeLine6") { setImage(treeLine6); objectCenter = 50; } if(object == "wallBackHouse") { setImage(wallBackHouse); objectCenter = 20; } if(object == "wallBackCenter") { setImage(wallBackCenter); objectCenter = 20; } if(object == "buildCenterUp") { setImage(buildCenterUp); objectCenter = 75; } if(object == "buildCenterLeft") { setImage(buildCenterLeft); objectCenter = 75; } if(object == "buildCenterRight") { setImage(buildCenterRight); objectCenter = 75; } if(object == "buildHomePlayerUp") { setImage(buildHomePlayerUp); objectCenter = 75; } if(object == "buildHomePlayerLeft") { setImage(buildHomePlayerLeft); objectCenter = 75; } if(object == "buildHomePlayerRight") { setImage(buildHomePlayerRight); objectCenter = 75; } } public void act() { //both methods are super class methods, the collide method uses the objectCenter variable to collide with the player checkPlayer(); collide(); } }