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

2012/12/14

Failure to change

ader108 ader108

2012/12/14

#
In my game, the zombie is supposed to eat the NPCs and then turn them into another zombie. This used to work.. until in attempts to condense I combined the two NPC classes and the four Zombie classes. Currently it simply removes the object and adjusts its image to the zombie relating to the object removed.
public void act()
    {
        int nom = Player1.getNom();
        int nawm = Peeps.getNawm();
        /**followHuman();
        */
       if(canMove()) {
            move();
        }
         else {
            move();
        }
        if(foundPlayer1()){
            Greenfoot.playSound("nom.wav");
        if(nom == 1 || nom == 11){
            getWorld().addObject(this, getX(), getY());
            setImage("greyPZombie.png");
            ties = 1;
        }
        else
        if(nom == 2 || nom == 12){
            getWorld().addObject(this, getX(), getY());
            setImage("bluePZombie.png");
            ties = 2;
        }
        else
        if(nom == 3 || nom == 13){
            getWorld().addObject(this, getX(), getY());
            setImage("greenPZombie.png");
            ties = 3;
        }
        else
        if(nom == 4 || nom == 14){
            getWorld().addObject(this, getX(), getY());
            setImage("redPZombie.png");
            ties = 4;
        }
        else
        if(nom == 5 || nom == 15){
            getWorld().addObject(this, getX(), getY());
            setImage("whitePZombie.png");
            ties = 5;
        }
        else
        if(nom == 6 || nom == 16){
            getWorld().addObject(this, getX(), getY());
            setImage("blackPZombie.png");
            ties = 6;
        }
        else
        if(nom == 7 || nom == 17){
            getWorld().addObject(this, getX(), getY());
            setImage("goldPZombie.png");
            ties = 7;
        }
        else
        if(nom == 8){
            getWorld().addObject(this, getX(), getY());
            setImage("Zombie.png");
            ties = 8;
        }
        else
        if(nom == 9){
            getWorld().addObject(this, getX(), getY());
            setImage("Zombie2.png");
            ties = 9;
        }
        else
        if(nom == 10){
            getWorld().addObject(this, getX(), getY());
            setImage("greyPZombie.png");
            ties = 10;
        }
        eatPlayer1();
        }
        if(foundPeeps()){
            Greenfoot.playSound("nom.wav");
            if(nawm == 8){
                getWorld().addObject(this, getX(), getY());
                setImage("zombie.png");
                ties = 8;
            }
            if(nawm == 9){
                getWorld().addObject(this, getX(), getY());
                setImage("zombie2.png");
                ties = 9;
            }
            eatPeeps();
        }
    }
You need to login to post a reply.