首 页
网络学院
视频教程
资源下载
HOT
实例教程
图文教程
专题中心
学习社区
繁體中文
当前位置:
首页
>
图文教程
>
网络编程
>
Javascript
> js版本A*寻路算法
Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document
No.
«
‹
70
71
72
73
›
»
技术文章搜索
关键字
Javascript 中的 js版本A*寻路算法
出处:
互联网
整理:
软晨网(RuanChen.com)
发布:
2009-09-12
浏览: 146 ::
收藏到网摘: n/a
在window.setTimeout方法中传送对象
用js重建星际争霸
说到做游戏,必不可少的需要用到寻路算法,一般游戏里的寻路算法大多数都以A*算法为主,这里也就实现了js里采用a*寻路的程序,在51js和蓝色都开了帖。
程序是以前写的,后来也没有修正或者精简,有冗余之处大家还见谅一下。
当然,这个寻路算法也不是最优化的,像幻宇开发的“交点寻径法”也是个中精品,两者可谓各有千秋,只是如果地图很大的情况下,我们会惊讶于“交点寻径法”的迅速。
点击运行可以看到效果:
use A* to find path...
设置起点
设置终点
设置障碍点
25,0;25,1;25,3;25,4;25,5;25,6;25,7;0,8;1,8;2,8;3,8;4,8;5,8;6,8;7,8;25,8;7,9;25,9;7,10;25,10;7,11;25,11;6,12;25,12;5,13;6,13;25,13;5,14;21,14;25,14;5,15;18,15;19,15;20,15;21,15;25,15;5,16;11,16;12,16;13,16;14,16;15,16;16,16;17,16;18,16;19,16;22,16;25,16;5,17;11,17;23,17;24,17;25,17;5,18;6,18;7,18;8,18;9,18;10,18;11,18;13,18;23,18;24,18;25,18;6,19;7,19;8,19;13,19;23,19;24,19;25,19;6,20;14,20;23,20;24,20;26,20;7,21;8,21;13,21;14,21;15,21;20,21;21,21;22,21;27,21;0,22;1,22;2,22;4,22;5,22;6,22;7,22;12,22;13,22;14,22;16,22;19,22;20,22;21,22;26,22;27,22;28,22;8,23;9,23;10,23;11,23;12,23;13,23;17,23;18,23;19,23;22,23;13,24;14,24;15,24;18,24;21,24;23,24;20,25;24,25;19,26;25,26;26,26;19,28;19,29;19,30;19,31