i was given commands, treeToRight(), treeToLeft(), treeBelow(), and treeAbove()
i wanted the ghost to move separately later on, after hitting a tree above but can't, how can you do it?
here's my code:
public void act() { int k = 2; if ( isToMyRight( getGhostHealer() ) ) { setDirection( "right" ); animate(); if ( intersects( getGhostHealer() ) && !treeAbove() ) { setDirection( "up" ); left(); getDirection(); treeDownWest(); } } else if ( isToMyLeft( getGhostHealer() ) ) { setDirection( "left" ); animate(); if ( intersects( getGhostHealer() ) && !treeAbove() ) { setDirection( "up" ); right(); treeDownEast(); } } if ( treeAbove() && treeToRight() ) { setDirection( "down" ); getClara(); if ( treeToLeft() && treeToRight() ) setDirection( "down" ); } if ( treeAbove() && treeToLeft() ) { setDirection( "down" ); getClara(); if ( treeToLeft() && treeToRight() ) setDirection( "down" ); } if ( treeBelow() && treeToRight() ) { setDirection( "up" ); getClara(); } else setDirection( "left" ); if ( treeAbove() && treeBelow() ) setDirection( "left" ); else setDirection( "up" ); } void treeDownEast() { if ( treeBelow() ) setDirection( "right" ); else setDirection( "down" ); } void treeDownWest() { if ( treeBelow() ) setDirection( "left" ); else setDirection( "down" ); }