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

Report as inappropriate.

awesomeinmyworld
awesomeinmyworld presents ...

2013/12/20

Epic Quest

A game that I've been working on. But time constraints have not allowed me to finish, I just got the jump and room changing codes down. I hope to get back to this.

1351 views / 4 in the last 7 days

Tags: with-source

open in greenfoot
Your browser does not support the canvas tag.
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.

See all comments

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.