[Pogamut-list] Controlling Bot

bulent pogamut-forum at diana.ms.mff.cuni.cz
Tue Dec 21 01:47:41 CET 2010


Re: Controlling Bot

Author: bulent

Thanks for the reply. I tried this code:

{CODE()}
public void run(){
            IUT2004Observer obs = new UT2004ObserverRunner(new UT2004ObserverFactory(new UT2004ObserverModule()), enemy.getId().getStringId()).startAgent();
            obs.getAct().act(new InitializeObserver().setId(enemy.getId().getStringId()));
            obs.getAct().act(new ConfigurationObserver().setUpdate(0.2).setAll(true).setAsync(true).setGame(false).setSee(false).setSpecial(false));
            System.out.println("Agent NAME: "+obs.getName());
            System.out.println("There are "+obs.getWorldView().getAll(NavPoint.class).values().size()+" nav points");
            obs.getWorldView().addEventListener(BotDamaged.class, botDamaged);
}
{CODE}

and outside of the function created botDamaged function

{CODE()}
IWorldEventListener botDamaged = new IWorldEventListener < BotDamaged > () {
        public void notify(BotDamaged event) {
            System.out.println("BOT DAMAGED");
        }
}
{CODE}

And my main function is:
{CODE()}
public static void main(String args[]) throws PogamutException {
        new EmptyBot().run();
}
{CODE}


'enemy' variable is type of Player and is the second player that I play against.
I only get "There are 0 nav points" message and no bot damaged messages.

Is there something I'm missing or I need to redesign my code?
Thanks

-- 
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=4&comments_reply_threadId=4&comments_parentId=446&post_reply=1#form>





More information about the Pogamut-list mailing list