Go to Post Or you could go to the Waterloo or Greater Toronto regional, walk up to anyone in their pit, and ask. You may end up feeling like you asked for a sip of water and ended up soaked by a fire hose, but you won't walk away disappointed. - Richard Wallace [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-02-2012, 20:24
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
Simple As That

See below
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 22-02-2012 at 20:27. Reason: forgot to code wrap it
Reply With Quote
  #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
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:53.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi