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

2013/3/2

MARIO WINS SCREEN NEED HELP!!

Prish950 Prish950

2013/3/2

#
I have a problem i want to write that if Mario is dead that a winner images for luigi appear and on the otherway the same. i wrote:
public void act()
    {
                     
            if (marioDead())
            {
              winnerLuigi();
            }
            
            if (luigiDead())
            {
              winnerMario();
            }
     }
     
    public void winnerMario()
    {
            List objekte = getObjects(null);
            removeObjects(objekte);
            setBackground("winnerMario.jpg");
            
    }
    
    public void winnerLuigi()
    {
            List objekte = getObjects(null);
            removeObjects(objekte);
            setBackground("winnerLuigi.jpg");
            
    }

      public boolean marioDead() 
      {  
        return getObjects(Bomber1.class).isEmpty();  
     
      }
      
      public boolean luigiDead() 
      {  
        return getObjects(Bomber2.class).isEmpty();  
     
      }
The problem with this code is that every time just the mario image appear. need help pls..!!!!
davmac davmac

2013/3/3

#
I can't see anything clearly wrong with the code you've pasted above. Could you upload the full scenario with source?
Prish950 Prish950

2013/3/3

#
it solved :D i take the luigi dead off and the getObjects(Bomber1.class).isEmpty(); in the if function
You need to login to post a reply.