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

2014/12/24

Switching World issue

Dillybar Dillybar

2014/12/24

#
Sorry for asking for help twice in a row but I've been doing a lot of coding and am now stuck again. I am using danpost's SWorld as a super world to have scrolling in my world. My issue comes when I try to switch the world to a new world, still under the super world. This creates a new world, however the background image does not show up. The background image is defined the same way in the second world as it is in the first world (copy/pasted actually). Here is my code for switching the image:
if (Greenfoot.isKeyDown("p"))
        {
            Greenfoot.setWorld(new WorldTwo());
        }
Thanks in advance for all of your help
Super_Hippo Super_Hippo

2014/12/24

#
If the world changes as expected, then you should show the constructor (+the field of the background image if used) of the WorldTwo world.
danpost danpost

2014/12/25

#
You say 'this creates the new world'; so, if the code given works, then that is not what you should be posting. FYI, the four-step procedure must be followed for each world subclass -- that is, (1) create the class; (2) the 'super' call; (3) the 'setMainActor' call; and possibly (4) the 'setScrollingBackground' or 'fillScrollingBackground' call.
Dillybar Dillybar

2014/12/25

#
Ah of course, that makes sense. I did some fooling around and it worked. TY :)
You need to login to post a reply.