I tried to make a code for adding an actor when i clicked in my world. The problem is that after i placed him, i can t click any of the buttons in the world. This is my code: The codding for clicking the buttons is in the buttons void act(). I could post them as well if it would help you.
If someone could help me I ll be very grateful.
int caracter=0; public void act() { backgroundMusic.playLoop(); Score score1 = new Score(); Zona zona = new Zona(); if(getObjects(Zona.class).size()==0) addObject(zona,getWidth()/4+37*2,getHeight()/2+20); if (caracter==0) if(Greenfoot.mouseClicked(null)) { MouseInfo mouseInfo = Greenfoot.getMouseInfo(); int x = mouseInfo.getX(); int y = mouseInfo.getY(); addObject(new Astronaut1(), x, y); removeObject(zona); caracter++; } if(getObjects(Score.class).size() == 0) { addObject(score1, getWidth()/2-110, 10); Score.score=0; } if(getObjects(Active_O2_Farms.class).size() == 0) addObject(new Active_O2_Farms(), getWidth()/2-110, 50); setPaintOrder(Viata1.class,Viata2.class,Viata3.class,Viata4.class, Inamicii.class, umbra.class, O2_Farm.class,Astronaut1.class, Zona.class); Buton Buton_next= new Buton(); if(caracter>0 && buton_count==1 && getObjects(proiectil.class).size() == 0 && getObjects(Buton_shoot.class).size() == 0) { addObject(Buton_next, 80, 419); buton_count++; } if(buton_count==2 && getObjects(Buton.class).size() == 0) { addObject(new Buton_shoot(), 80, 419); buton_count=1; }