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

2015/11/4

Help with this error I can not shake off; direction

ereal1 ereal1

2015/11/4

#
{
    /**
     * Act - do whatever the Alien wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
 public void act() 
 {
    //this.move(1);
    
    if (direction)
    {
      this.move(3);  
    }
    else 
    {
      this.move(-3);
    }        
    if (direction)
    {       
        if(this.getX()>=510)
        {
            direction = false;
        }
    }
    else if(this.getX()<=32)
    {
        direction = true;
    }
 }
}
}
danpost danpost

2015/11/4

#
There does not appear to be any errors in the code provided. What error message are you getting? If it is in the terminal window, copy/paste the entire output here.
You need to login to post a reply.