Thread: Simple As That
View Single Post
  #2   Spotlight this post!  
Unread 22-02-2012, 20:26
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Simple As That

Code:
public class AutoAim extends NeverEndingCommand{
    
    public String currentCommand = new FaceNorthAimCenter().getName();

    protected void initialize() {
    }

    protected void execute() {
        if(Bob.dt.isFacingEast() && 
                ! currentCommand.equalsIgnoreCase(new FaceEast().getName())){
            currentCommand = new FaceEast().getName();
            new FaceEast().start();
        }else if (Bob.dt.isFacingWest() &&
                !currentCommand.equalsIgnoreCase(new FaceWest().getName())){
            currentCommand = new FaceWest().getName();
            new FaceWest().start();
        }else if(!currentCommand.equalsIgnoreCase(new FaceNorthAimCenter().getName())){
            currentCommand = new FaceNorthAimCenter().getName();
            new FaceNorthAimCenter().start();
        }else{
            //do nothing, the right command is alreay executing
        }
    }
    
}
__________________
"Never let your schooling interfere with your education" -Mark Twain
Reply With Quote