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

2012/5/18

Change world image

TechWebLock TechWebLock

2012/5/18

#
Hi, I am back with question 2 of 2 million!!! I have made the level code work as I want thanks to the help from members on here but I am having an issue changing the world's background image. Usually I would do something like this for an actor.
mainwindow fighterWorld = (mainwindow)getWorld();// create a specific world name for mainwindow
       if (fighterWorld.level == 1) //if the level is 1
       {
       setImage("bp1.png"); //set image as bad plane 1
       }
If I tried the same thing in the world I get errors. cannot find symbol - method setImage (java.lang.String). I am guessing I would need to say something on the lines of setbackgroundImage but I am not sure. Thanks in advance :)
TechWebLock TechWebLock

2012/5/18

#
Aha I have found the code to change the world. This seems to work very well!!! If there is any other solutions I would love to know.
trash1000 trash1000

2012/5/18

#
I don't think you have another method to change the world's background other than with 'setBackground()'
TechWebLock TechWebLock

2012/5/18

#
trash1000 wrote...
I don't think you have another method to change the world's background other than with 'setBackground()'
You saved me again thanks :-) I dont know why I didnt try that LOL
You need to login to post a reply.