纳金网

标题: [as3基础应用]AS3寻路算法-基于广度优先搜索(第三部分) [打印本页]

作者: .    时间: 2013-3-20 10:22
标题: [as3基础应用]AS3寻路算法-基于广度优先搜索(第三部分)
主场景第一帧
var map:Map=new Map(20,20);var searched:Boolean=false;this.addChild(map);lockBtn.addEventListener(MouseEvent.CLICK,lock);unLockBtn.addEventListener(MouseEvent.CLICK,unLock);rootBtn.addEventListener(MouseEvent.CLICK,setRoot);targetBtn.addEventListener(MouseEvent.CLICK,setTarget);searchBtn.addEventListener(MouseEvent.CLICK,search);map.addEventListener(MouseEvent.CLICK,otherLock);function lock(e:MouseEvent):void{ var theX:int=int(xStation.text); var theY:int=int(yStation.text); if(searched==***e) { map.clear(); searched=false; } map.lock(theX,theY);}function otherLock(e:MouseEvent):void{ var theX:int=int(e.stageX/20); var theY:int=int(e.stageY/20); if(searched==***e) { map.clear(); searched=false; } map.lock(theX,theY);}function unLock(e:MouseEvent):void{ var theX:int=int(xStation.text); var theY:int=int(yStation.text); if(searched==***e) { map.clear(); searched=false; } map.unlock(theX,theY);}function setRoot(e:MouseEvent):void{ var theX:int=int(xStation.text); var theY:int=int(yStation.text); if(searched==***e) { map.clear(); searched=false; } map.setRoot(theX,theY);}function setTarget(e:MouseEvent):void{ var theX:int=int(xStation.text); var theY:int=int(yStation.text); if(searched==***e) { map.clear(); searched=false; } map.setTarget(theX,theY);}function search(e:MouseEvent):void{ map.search(); searched=***e;} 【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/
作者: kikkik7000    时间: 2014-8-4 12:58
THanks for sharing !

作者: tianhett    时间: 2015-2-3 13:06
这东西貌似挺高级的!!!!!!!!!!




欢迎光临 纳金网 (http://rs.narkii.com/club/) Powered by Discuz! X2.5