My main character "saves" the current world he is by getting all the objects in it and storing it in an List of Actors. Then when returning to that room a different constructor for that world is called passing it the list.
My problem is that when you return to a room that has its objects restored the background image lingers from the room you just left. Here is that second constructor (the part bellow is actually inherited and called using super):
I tried setting the background in the world as so:
But that doesn't work. I have looked at Actor objects and they seem to store the background image of the world they were in, but I'm not sure that has anything to do with it.
Any ideas? Thanks in advance for any help!
public SuperWorld(Player newP, int x, int y, List<Actor> fromSave) { super(xS, yS, 1); for (Actor A : fromSave) { //...// addObject(A,A.getX(),A.getY()); } addObject (newP, x, y); }
//Player is the main character public Room1(Player newP, int x, int y, List<Actor> fromSave) { super(newP, x, y, fromSave); //code above setBackground("roombg3_fullsize.png"); }