Maybe, could you make the other rooms the primary room and just place the objects and use the save the world feature and swap them back in their proper place? I would use an array or something to keep the room formats and just place the object upon switching.
look at the worlds you have, right click on the world you wish to edit, select 'new World1()'; where World1 is the name of your class. This will become the background. Edit it and then use the save the world option. repeat this process to put your original room back.
A new version of this scenario was uploaded on Thu Jan 09 16:46:39 UTC 2014
There are platforms in other rooms now, and the jump code is better. However, it doesn't seem to be playable now.
I've found now that my game won't run. It highlights a part of my code and the terminal window reads "NullPointerException". Do you know what that means?
There may be an instance of Player that is not referring to the one we see on the screen; Danpost might know what is up as to why it is null. I might try removing the actor from the world, clean up anything that referenced then and then re-add them (the player) and see if that helps.
oh in your world1 prepare method you have:
Player player = new Player();
addObject(player, 50, 415);
which makes this player show up locally, you have a Actor called Player that is not being initialized for some reason (even though it looks like MyWorld constructor makes one, but is is not) Change in prepare on room1 to:
Player = new Player();
addObject(player, 50, 415);
and the Player Object becomes not null.
@lordhershey, you are half right. You got the right location and some of the problem; but not the right correction.
Remove the code in the Room1 class in the 'prepare' method that creates and adds a Player object into the world. Then right-click on your MyWorld icon and select 'new MyWorld()' from the drop-down list. That should fix the problem.
Thanks, I had just tried a quick test, but not sure if that was the way to go. Will this properly call the add they have in the my world base class? Will there be any player spawning issues when they change screen?
You should only have to spawn the one initial player. It gets passed from world to world without any new ones being created.
I am not sure what are you referring to with 'the add they have in the my world base class'. However the line in the world constructor that start 'addObject' can be removed. The player can immediately be added into the 'Room1' world (your 'world.addObject...' line) without being added into the current 'MyWorld' world.
The room transitions seem to work well. If you fall to the bottom , you cannot jump back up, I would make a die routine that put the player back to their start position in the room. If you hit reset you see a different scene is seen.
2014/1/7
2014/1/7
2014/1/8
2014/1/8
2014/1/9
2014/1/9
2014/1/9
2014/1/10
2014/1/13
2014/1/13
2014/1/13
2014/1/13
2014/1/13
2014/1/13
2014/1/14
2014/1/14
2014/1/14
2014/1/16
2014/1/16