This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Epic Quest

Return to Epic Quest

I'm having trouble trying to place platforms in the second and third rooms. Can anyone help me?
lordhersheylordhershey

2014/1/7

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.
how would I make a different room a primary room?
lordhersheylordhershey

2014/1/8

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.
Thank you very much!
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?
lordhersheylordhershey

2014/1/9

Would have to see the entire message. It should have a line number in there.
lordhersheylordhershey

2014/1/10

The Act Method of the World where you are calling Player.getX() is the issue , I am not 100% sure why as it appears the player is in the world.
The Player.getX() is a part of the room changing code, which I used from Danpost.
lordhersheylordhershey

2014/1/13

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.
lordhersheylordhershey

2014/1/13

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.
danpostdanpost

2014/1/13

@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.
lordhersheylordhershey

2014/1/13

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?
danpostdanpost

2014/1/13

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.
Thank you danpost, lordhershey! It's fixed now.
lordhersheylordhershey

2014/1/14

I'll give it a try when I can take a break :)
lordhersheylordhershey

2014/1/14

I have hit the run button , but it seems to stop - did you upload the code yet?
Not yet.
A new version of this scenario was uploaded on Thu Jan 16 16:08:45 UTC 2014 It actually works now.
lordhersheylordhershey

2014/1/16

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.