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

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

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

?? 國外的一個A*算法演示
?? 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一区二区三区免费野_久草精品视频
成人激情免费视频| 精品国产欧美一区二区| 色综合天天视频在线观看| 国产乱人伦偷精品视频不卡| 久久99精品久久久久久| 国产一区二区三区免费看| 麻豆91在线看| 国产在线精品不卡| 国产精品一区二区三区网站| 国产精品资源在线观看| 国产成人精品免费网站| 成a人片亚洲日本久久| 97国产一区二区| 在线一区二区三区做爰视频网站| 色欧美88888久久久久久影院| 91丨九色丨蝌蚪丨老版| 欧美在线免费播放| 91精品国产一区二区三区| 日韩欧美中文字幕公布| 久久久99精品免费观看不卡| 国产精品久久久久久久久搜平片| 亚洲视频每日更新| 亚洲1区2区3区4区| 久久激情五月婷婷| 国产一区二区美女| 不卡一二三区首页| 欧美色图第一页| 欧美本精品男人aⅴ天堂| 国产欧美中文在线| 91在线视频免费观看| 一本到不卡免费一区二区| 欧美日韩高清不卡| 久久免费偷拍视频| 亚洲美女视频一区| 免费看欧美女人艹b| 国产精品乡下勾搭老头1| 一本色道久久综合亚洲精品按摩| 在线播放日韩导航| 亚洲国产精品激情在线观看| 亚洲一区二区三区美女| 精品亚洲成a人| 一本色道久久综合亚洲精品按摩| 538在线一区二区精品国产| 国产亚洲精品精华液| 亚洲一区二区三区四区中文字幕| 久久国产精品一区二区| 99re热这里只有精品免费视频| 欧美日韩mp4| 中文字幕精品在线不卡| 亚洲国产va精品久久久不卡综合| 黑人精品欧美一区二区蜜桃| 91亚洲午夜精品久久久久久| 日韩一区二区三区四区| 自拍偷在线精品自拍偷无码专区| 日韩黄色小视频| 99精品一区二区| 日韩女优制服丝袜电影| 91搞黄在线观看| 26uuu亚洲综合色| 欧美日韩一区二区三区高清 | 亚洲天堂免费在线观看视频| 亚洲成人资源网| 国产成人啪免费观看软件| 欧美日韩小视频| 国产精品久久久久久久久图文区 | 久久精品久久99精品久久| 91色视频在线| 国产亚洲一区二区在线观看| 亚洲h在线观看| 91免费国产在线观看| 久久丝袜美腿综合| 日韩电影在线免费观看| 91啪九色porn原创视频在线观看| 久久综合av免费| 日本不卡一区二区三区| 91黄色激情网站| 国产精品狼人久久影院观看方式| 久久精品国产免费看久久精品| 欧美日韩一区久久| 亚洲黄色小说网站| 成人美女视频在线看| 久久久久亚洲综合| 麻豆91在线播放| 91麻豆精品国产综合久久久久久| 成人免费一区二区三区视频| 国产精品一区三区| 精品免费日韩av| 久久综合综合久久综合| 9191成人精品久久| 亚洲一区二区三区四区在线| 91丨porny丨国产| 1区2区3区国产精品| 成人中文字幕合集| 久久久不卡网国产精品一区| 极品销魂美女一区二区三区| 欧美mv和日韩mv的网站| 青草国产精品久久久久久| 这里是久久伊人| 蜜桃av一区二区在线观看| 91精品久久久久久久91蜜桃| 亚洲成人av免费| 欧美日韩一区二区三区不卡| 亚洲资源在线观看| 在线视频你懂得一区二区三区| 亚洲品质自拍视频| 91麻豆成人久久精品二区三区| 亚洲日韩欧美一区二区在线| 色综合久久66| 亚洲亚洲人成综合网络| 欧美日韩在线一区二区| 日产国产欧美视频一区精品 | 日韩成人一级片| 欧美精品久久一区二区三区| 丝袜脚交一区二区| 欧美一级片在线看| 久久精品免费看| 国产欧美日韩在线视频| av一区二区三区在线| 亚洲综合色噜噜狠狠| 制服丝袜一区二区三区| 国产一区二三区好的| 国产精品福利av| 欧美自拍偷拍一区| 蜜臀99久久精品久久久久久软件| 精品福利二区三区| 成人免费视频一区二区| 亚洲欧洲制服丝袜| 制服丝袜av成人在线看| 国产在线观看免费一区| 国产日韩精品视频一区| 色狠狠av一区二区三区| 日韩影院免费视频| 久久久.com| 色哟哟国产精品| 视频一区在线播放| 久久久影视传媒| 在线视频欧美区| 黄网站免费久久| 亚洲人成网站在线| 日韩欧美在线123| 波多野结衣中文字幕一区| 一区二区成人在线视频| 日韩视频免费观看高清完整版 | 色婷婷av一区二区三区之一色屋| 亚洲3atv精品一区二区三区| 久久尤物电影视频在线观看| 97久久超碰精品国产| 日韩国产精品大片| 国产精品无人区| 69成人精品免费视频| 国产精品一区二区久久不卡| 亚洲精品美腿丝袜| 欧美一区二区三区日韩视频| 夫妻av一区二区| 图片区日韩欧美亚洲| 国产精品久久免费看| 91精品国模一区二区三区| av男人天堂一区| 美国精品在线观看| 亚洲欧美在线视频| 精品国产伦一区二区三区观看方式 | 国产ts人妖一区二区| 亚洲成a天堂v人片| 久久精品欧美日韩精品 | 欧美激情在线看| 欧美一区二区性放荡片| 99综合影院在线| 麻豆视频一区二区| 亚洲国产欧美在线| 亚洲国产精品t66y| 欧美变态凌虐bdsm| 欧美日韩mp4| 色系网站成人免费| 国产99久久久久久免费看农村| 日本成人在线看| 亚洲r级在线视频| 亚洲欧洲99久久| 国产欧美一区二区精品秋霞影院| 欧美一区二区三区在线电影| 91视频观看视频| 成人免费看的视频| 国产尤物一区二区| 蜜臀av一级做a爰片久久| 亚洲va韩国va欧美va精品| 亚洲欧美日韩电影| 中文字幕一区二区三区蜜月| 久久免费精品国产久精品久久久久| 欧美一区二区三区日韩| 欧美美女网站色| 欧美色网站导航| 91久久久免费一区二区| av不卡在线观看| 风间由美一区二区av101| 国产一区二区三区免费看 | 欧美福利视频导航| 欧美性色黄大片手机版| 在线观看日韩毛片| 91蝌蚪porny九色| 91视频在线观看| 色哟哟精品一区|