亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? astarlibrary - demo 3 (4 way).bb

?? a_star_pathfinder A星路徑尋找可以用來學習尋路的方法 可以用到很多地方 比如脫機的AI尋路就可以用到他
?? BB
?? 第 1 頁 / 共 2 頁
字號:
;A* Pathfinder (Version 1.83) by Patrick Lester. Used by permission.
;==================================================================
;Last updated 03/19/04

;This version of the A* pathfinder is modified to only allow 4 directional
;movement, which may be better suited for platform games.

;An article describing A* and this code in particular can be found at:
;http://www.policyalmanac.org/games/aStarTutorial.htm

;If you want to use this AStar Library, you may do so free of charge so 
;long as the author byline (above) is retained. Thank you to CaseyC 
;at the Blitz Forums for suggesting the use of binary heaps for the open 
;list. Email comments and questions to Patrick Lester at 
;pwlester@policyalmanac.org.

;Setup
;-----
;1. Include "includes/aStarLibrary.bb" at the top of your program.

;2. Create an array called walkability(x,y) that contains information
;	about the walkability of each square/tile on your map, with
;	0 = walkable (the default value) and 1 = unwalkable. The array
;	should range from (0,0) in the upper left hand corner to 
;	(mapWidth-1,mapHeight-1) in the bottom right hand corner.

;3. Adjust the following variables at the top of the .declareVariables
;	subroutine below. All three should be made global.
;	- tileSize = the width and height of your square tiles in pixels
;	- mapWidth = the width of your map in tiles = x value in
;		walkability array.
;	- mapHeight = the height of your map in tiles = y value in
;		walkability array.


;Calling the functions
;---------------------
;There are three main functions

;1.	FindPath(unit.unit,targetX,targetY)
;	- unit.unit = unit that is doing the pathfinding
;	- targetX,targetY = location of the target destination (pixel based coordinates)

;	The FindPath() function returns whether a path could be found (1) or
;	if it's nonexistent (2). If there is a path, it stores it in a bank
;	called unit\pathBank.

;2.   CheckPathStepAdvance(unit.unit)
;	This function updates the current path.

;3.	ReadPath(unit.unit)
; 	This function reads the path data generated by FindPath() and returns
;	the x and y coordinates of the next step on the path. They are stored
;	as xPath and yPath. These coordinates are pixel coordinates 
;	on the screen. See the function for more info.

;==========================================================
;DECLARE VARIABLES
.declareVariables

	;Adjust these variables to match your map dimensions (see "setup" above)
	Global tileSize = 50, mapWidth = 16, mapHeight = 12

	;Create needed arrays
	Dim walkability(mapWidth+1,mapHeight+1) ;array that holds wall/obstacle information	
	Dim openList(mapWidth*mapHeight+2) ;1 dimensional array holding ID# of open list items
	Dim whichList(mapWidth+1,mapHeight+1)  ;2 dimensional array used to record 
		;whether a cell is on the open list or on the closed list.
	Dim openX(mapWidth*mapHeight+2) ;1d array stores the x location of an item on the open list
	Dim openY(mapWidth*mapHeight+2) ;1d array stores the y location of an item on the open list
	Dim parentX(mapWidth+1,mapHeight+1) ;2d array to store parent of each cell (x)
	Dim parentY(mapWidth+1,mapHeight+1) ;2d array to store parent of each cell (y)
	Dim Fcost(mapWidth*mapHeight+2)	;1d array to store F cost of a cell on the open list
	Dim Gcost(mapWidth+1,mapHeight+1) 	;2d array to store G cost for each cell.
	Dim Hcost(mapWidth*mapHeight+2)	;1d array to store H cost of a cell on the open list		
	
	;Declare constants
	Global onClosedList = 10 ;openList variable	
	Const notfinished = 0, notStarted = 0, found = 1, nonexistent = 2; pathStatus constants 
	Const walkable = 0, unwalkable = 1; walkability array constants


;==========================================================
;FIND PATH: This function finds the path and saves it. Non-Blitz users please note,
;the first parameter is a pointer to a user-defined object called a unit, which contains all
;relevant info about the unit in question (its current location, speed, etc.). As an
;object-oriented data structure, types are similar to structs in C.
;	Please note that targetX and targetY are pixel-based coordinates relative to the
;upper left corner of the map, which is 0,0.
Function FindPath(unit.unit,targetX,targetY)

;1.	Convert location data (in pixels) to coordinates in the walkability array.
	startX = Floor(unit\xLoc/tileSize) : startY = Floor(unit\yLoc/tileSize)	
	targetX = Floor(targetX/tileSize) : targetY = Floor(targetY/tileSize)

;2.	Quick Path Checks: Under the some circumstances no path needs to
	;be generated ...

	;If starting location and target are in the same location...
	If startX = targetX And startY = targetY And unit\pathLocation > 0 Then Return found
	If startX = targetX And startY = targetY And unit\pathLocation = 0 Then Return nonexistent

	;If target square is unwalkable, return that it's a nonexistent path.
	If walkability(targetX,targetY) = unwalkable Then Goto noPath

;3.	Reset some variables that need to be cleared
	If onClosedList > 1000000 ;occasionally redim whichList
		Dim whichList(mapWidth,mapHeight) : onClosedList = 10
	End If	
	onClosedList = onClosedList+2 ;changing the values of onOpenList and onClosed list is faster than redimming whichList() array
	onOpenList = onClosedList-1
	unit\pathLength = notstarted ;i.e, = 0
	unit\pathLocation = notstarted ;i.e, = 0
	Gcost(startX,startY) = 0 ;reset starting square's G value to 0

;4.	Add the starting location to the open list of squares to be checked.
	numberOfOpenListItems = 1
	openList(1) = 1 ;assign it as the top (and currently only) item in the open list, which is maintained as a binary heap (explained below)
	openX(1) = startX : openY(1) = startY


;5.	Do the following until a path is found or deemed nonexistent.
	Repeat

	
;6.	If the open list is not empty, take the first cell off of the list.
	;This is the lowest F cost cell on the open list.
	If numberOfOpenListItems <> 0 Then

	;Pop the first item off the open list.
	parentXval = openX(openList(1)) : parentYVal = openY(openList(1)) ;record cell coordinates of the item
	whichList(parentXval,parentYVal) = onClosedList ;add the item to the closed list

	;Open List = Binary Heap: Delete this item from the open list, which
	;is maintained as a binary heap. For more information on binary heaps, see:
	;http://www.policyalmanac.org/games/binaryHeaps.htm
	numberOfOpenListItems = numberOfOpenListItems - 1 ;reduce number of open list items by 1	
	openList(1) = openList(numberOfOpenListItems+1) ;move the last item in the heap up to slot #1
	v = 1	
	Repeat ;Repeat the following until the new item in slot #1 sinks to its proper spot in the heap.
		u = v	
		If 2*u+1 <= numberOfOpenListItems ;if both children exist
		 	;Check if the F cost of the parent is greater than each child.
			;Select the lowest of the two children.	
			If Fcost(openList(u)) >= Fcost(openList(2*u)) Then v = 2*u
			If Fcost(openList(v)) >= Fcost(openList(2*u+1)) Then v = 2*u+1		
		Else
			If 2*u <= numberOfOpenListItems ;if only child #1 exists
			 	;Check if the F cost of the parent is greater than child #1	
				If Fcost(openList(u)) >= Fcost(openList(2*u)) Then v = 2*u
			End If	
		End If
		If u<>v ;if parent's F is > one of its children, swap them
			temp = openList(u)
			openList(u) = openList(v)
			openList(v) = temp				
		Else
			Exit ;otherwise, exit loop
		End If	
	Forever

	
;7.	Check the adjacent squares. (Its "children" -- these path children
	;are similar, conceptually, to the binary heap children mentioned
	;above, but don't confuse them. They are different. Path children
	;are portrayed in Demo 1 with grey pointers pointing toward
	;their parents.) Add these adjacent child squares to the open list
	;for later consideration if appropriate (see various if statements
	;below).
	For direction = 1 To 4
	
	If direction = 1 
		a = parentXVal : b = parentYVal-1
	Else If direction = 2 
		a = parentXVal-1 : b = parentYVal
	Else If direction = 3 
		a = parentXVal+1 : b = parentYVal
	Else If direction = 4 
		a = parentXVal : b = parentYVal+1
	End If		

	;If not off the map (do this first to avoid array out-of-bounds errors)
	If a <> -1 And b <> -1 And a <> mapWidth And b <> mapHeight

	;If not already on the closed list (items on the closed list have
	;already been considered and can now be ignored).			
	If whichList(a,b) <> onClosedList 
	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本最新不卡在线| 久久精品国产成人一区二区三区| 在线视频你懂得一区二区三区| 一二三区精品视频| 精品视频在线看| 亚洲午夜一区二区| 日韩精品一区二区三区在线观看 | 91视频免费观看| 亚洲一区二区欧美日韩 | 欧美国产成人精品| 波多野结衣一区二区三区| 精品一区二区免费视频| 国产精品久久久久国产精品日日| 欧美亚洲动漫精品| 国产成人精品免费视频网站| 亚洲成av人片在线| 国产视频一区二区在线| 色94色欧美sute亚洲线路一久| 久久精品国产第一区二区三区| 久久久久国产精品人| 欧美日韩成人高清| av在线不卡网| 久草精品在线观看| 香蕉久久夜色精品国产使用方法| 欧美成人猛片aaaaaaa| 久久国产精品无码网站| 天天av天天翘天天综合网色鬼国产 | 97精品久久久午夜一区二区三区| 国产精品888| 国产精品亚洲人在线观看| 久久国产精品99久久人人澡| 婷婷六月综合亚洲| 午夜伦欧美伦电影理论片| 亚洲影视在线观看| 亚洲永久精品大片| 亚洲成人高清在线| 99riav一区二区三区| 成人av网在线| 99久久久久久99| 一本色道久久综合亚洲aⅴ蜜桃| 成人不卡免费av| 97se亚洲国产综合在线| 99麻豆久久久国产精品免费优播| caoporm超碰国产精品| 成人免费的视频| 波多野结衣91| 在线观看视频一区| 欧美性一级生活| 91精品婷婷国产综合久久竹菊| 欧美日韩国产大片| 日韩欧美国产系列| 久久久综合激的五月天| 中文av一区特黄| 一区二区三区色| 午夜电影一区二区三区| 免费成人av资源网| 国产一区二区三区美女| 不卡电影免费在线播放一区| 91久色porny | 国产精品主播直播| av综合在线播放| 欧美性色黄大片手机版| 欧美日韩国产高清一区二区三区| 日韩亚洲欧美成人一区| 久久久久久久久久久电影| 国产精品久久国产精麻豆99网站| 亚洲精品ww久久久久久p站| 日本视频一区二区| 国产ts人妖一区二区| 色网站国产精品| 精品久久一区二区| 成人免费视频在线观看| 婷婷激情综合网| 国产不卡在线视频| 色狠狠一区二区三区香蕉| 日韩欧美中文一区二区| 中文字幕va一区二区三区| 亚洲一区成人在线| 国产综合成人久久大片91| 91日韩一区二区三区| 欧美一区二区视频在线观看| 国产欧美日韩精品在线| 一区二区三区国产精品| 激情国产一区二区| 欧美专区亚洲专区| 久久亚洲免费视频| 亚洲一卡二卡三卡四卡| 国产很黄免费观看久久| 67194成人在线观看| 中文字幕乱码一区二区免费| 五月综合激情婷婷六月色窝| 丁香激情综合国产| 日韩午夜av电影| 依依成人精品视频| 国产91高潮流白浆在线麻豆 | 成人精品小蝌蚪| 91精品国产综合久久国产大片| 欧美国产精品一区二区三区| 日本一不卡视频| 91久久精品一区二区| 国产偷国产偷精品高清尤物| 亚洲亚洲精品在线观看| 成人黄色一级视频| 精品国免费一区二区三区| 亚洲一二三四久久| 不卡电影一区二区三区| 精品久久国产字幕高潮| 日韩国产欧美在线播放| 色噜噜狠狠色综合中国| 中文字幕成人在线观看| 国产一区欧美日韩| 91精品黄色片免费大全| 悠悠色在线精品| 91首页免费视频| 国产精品日产欧美久久久久| 国产一区二区三区视频在线播放| 91精品国产综合久久久久久久久久 | 国产最新精品免费| 91麻豆精品国产综合久久久久久 | 91精品国产色综合久久| 亚洲另类一区二区| 成人综合在线观看| 久久久久久免费毛片精品| 丝袜诱惑制服诱惑色一区在线观看 | 91麻豆产精品久久久久久| 国产精品另类一区| 成人性色生活片免费看爆迷你毛片| 精品久久人人做人人爽| 久久er精品视频| 精品国产乱子伦一区| 九九九精品视频| 久久中文字幕电影| 国产麻豆日韩欧美久久| 久久一二三国产| 国产成人a级片| 中文字幕第一区综合| k8久久久一区二区三区| 亚洲色图一区二区| 91黄色小视频| 视频一区二区中文字幕| 日韩一级片网址| 久久国产精品无码网站| 国产亚洲女人久久久久毛片| 国产盗摄女厕一区二区三区| 中文字幕第一页久久| 91麻豆精东视频| 亚洲国产成人porn| 欧美一区二区三区公司| 精品一区二区三区免费视频| 久久久久久日产精品| 99久久99久久免费精品蜜臀| 一区二区三区免费看视频| 欧美日韩的一区二区| 日本女人一区二区三区| 欧美不卡一二三| 成人精品一区二区三区四区| 亚洲精品国产无套在线观| 欧美午夜不卡在线观看免费| 日韩电影在线一区二区三区| 精品国产一区二区三区忘忧草| 国产不卡视频一区二区三区| 亚洲免费观看高清| 欧美一区二区三区不卡| 国产福利一区二区三区视频在线 | 欧美一区二区三区系列电影| 久久国产成人午夜av影院| 久久久久国产精品麻豆ai换脸| eeuss鲁片一区二区三区在线观看| 亚洲精品福利视频网站| 日韩欧美亚洲国产另类| 成人app网站| 日韩精品久久理论片| 日本一区二区三区在线不卡| 欧美在线|欧美| 国产激情一区二区三区四区| 亚洲另类中文字| 欧美电影精品一区二区| 91麻豆蜜桃一区二区三区| 久久不见久久见免费视频7| 综合久久一区二区三区| 日韩一区二区在线观看| 色综合中文字幕| 韩国精品主播一区二区在线观看| 中文字幕亚洲在| 日韩一区二区精品在线观看| 91影院在线观看| 九九九久久久精品| 亚洲亚洲精品在线观看| 欧美激情一区二区三区全黄| 在线播放一区二区三区| 99国产精品国产精品久久| 久久99精品一区二区三区| 亚洲卡通欧美制服中文| 久久久久久毛片| 日韩一区二区在线免费观看| 在线观看中文字幕不卡| 国产a级毛片一区| 久久99精品国产麻豆婷婷洗澡| 一区二区三区在线免费视频| 国产欧美精品一区|