Hey guys!
I have a really big problem....for school i have to write a programm in greenfoot. I wanted to set up a Startscreen, which worked very well. I have a Background(SetBackground in World class) and 3 Buttons(Actors) for the 3 different Scenarios. Now i want to start the first Scenario i dont want to change the world, so just the Background must change and the Buttons must disapper. This should happen no matter which button i select. After this each button create different actors but this is another topic. Can someone say me pls who i can do this?
I tried in World class something like:
and for every Button this:
This don't worked well...I have no Idea last lesson i tried something with my teacher, but he can't help me very much...I tried many other things but they didnt worked aswell.... Hopefully you can help me....
Sorry for my really bad english, it isn't my native language
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public Hauptwelt() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super ( 600 , 400 , 1 ); Bild(); addObject( new Nbutton(), 300 , 50 ); addObject( new Bbutton(), 300 , 200 ); addObject( new Mbutton(), 300 , 350 ); } public void Bild() { setBackground( "brick.jpg" ); } public void populate1() { if (Greenfoot.mouseClicked(Nbutton. class )) { removeObject(Nbutton. class ); } } |
1 2 3 4 5 6 7 8 | public void act() { Bild(); } public void Bild() { setImage( "Mittelalter.png" ); } |