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

2019/4/20

why does this not work

Philipplol Philipplol

2019/4/20

#
int moveDelay = 0;
public void laufen2()
         
        {
            moveDelay ++;
            if (Greenfoot.getRandomNumber(5) == 1 && !wandRechts() && moveDelay == 3)
            {
                 
                 
                this.setImage(down);
                this.setLocation(getX(), getY()+1);
                moveDelay = 0;
                moveDelay ++;
            }
             
             
            if (Greenfoot.getRandomNumber(5) == 2 && !wandLinks() && moveDelay == 3)
            {
                 
                this.setImage(up);
                this.setLocation(getX(), getY()-1);
                moveDelay = 0;
                moveDelay ++;
            }
             
             
            if ((Greenfoot.getRandomNumber(5) == 3 && wandVorne()) && moveDelay == 3)
            {
                Greenfoot.delay(70);
                this.setImage(right);
                this.setLocation(getX()+1, getY());
                moveDelay = 0;
                moveDelay ++;
            }
            
             
            if(Greenfoot.getRandomNumber(5) == 4 && !wandHinten() && moveDelay == 3)
            {
                 
                this.setImage(left);
                this.setLocation(getX()-1, getY());
                moveDelay = 0;
                moveDelay ++;
            }
             
            
        }
Super_Hippo Super_Hippo

2019/4/20

#
… why do you create a separate discussion? Keep it in the other one and stop saying "it doesn't work" without any explanation!
Proprogrammer04 Proprogrammer04

2019/4/23

#
It would make things easier if you also use english words for your variables instead of german words
You need to login to post a reply.