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

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

?? astarlibrary - demo 4b (time based).bb

?? 國外的一個A*算法演示
?? BB
?? 第 1 頁 / 共 2 頁
字號:
	End If ;If not already on the closed list	
	End If ;If not off the map.	
	Next
	Next

;9.	If open list is empty then there is no path.	
	Else
		path = nonExistent : Exit
	End If

	;If target is added to open list then path has been found.
	If whichList(targetx,targety) = onOpenList Then path = found : Exit		

	Forever ;repeat until path is found or deemed nonexistent
	
	
;10.	Save the path if it exists. Copy it to a bank. 
	If path = found
		
		;a. Working backwards from the target to the starting location by checking
		;each cell's parent, figure out the length of the path.
		pathX = targetX : pathY = targetY	
		Repeat
			tempx = parentX(pathX,pathY)		
			pathY = parentY(pathX,pathY)
			pathX = tempx
			unit\pathLength = unit\pathLength + 1	
		Until pathX = startX And pathY = startY
	
		;b. Resize the data bank to the right size (leave room to store step 0,
		;which requires storing one more step than the length)
		ResizeBank unit\pathBank,(unit\pathLength+1)*4

		;c. Now copy the path information over to the databank. Since we are
		;working backwards from the target to the start location, we copy
		;the information to the data bank in reverse order. The result is
		;a properly ordered set of path data, from the first step to the
		;last.	
		pathX = targetX : pathY = targetY				
		cellPosition = unit\pathLength*4 ;start at the end	
		While Not (pathX = startX And pathY = startY)			
			PokeShort unit\pathBank,cellPosition,pathX ;store x value	
			PokeShort unit\pathBank,cellPosition+2,pathY ;store y value	
			cellPosition = cellPosition - 4 ;work backwards		
			tempx = parentX(pathX,pathY)		
			pathY = parentY(pathX,pathY)
			pathX = tempx
		Wend	
		PokeShort unit\pathBank,0,startX ;store starting x value	
		PokeShort unit\pathBank,2,startY ;store starting y value

	End If ;If path = found Then 

;11. Return info on whether a path has been found.
	Return path; Returns 1 if a path has been found, 2 if no path exists. 

;12.If there is no path to the selected target, set the pathfinder's
	;xPath and yPath equal to its current location and return that the
	;path is nonexistent.
	.noPath
	unit\xPath = startingX
	unit\yPath = startingY
	Return nonexistent

End Function
	

;==========================================================
;READ PATH DATA: These functions read the path data and convert
;it to screen pixel coordinates.
Function ReadPath(unit.unit)			
	unit\xPath = ReadPathX(unit.unit,unit\pathLocation)
	unit\yPath = ReadPathY(unit.unit,unit\pathLocation)
End Function

Function ReadPathX#(unit.unit,pathLocation)
	If pathLocation <= unit\pathLength
		x = PeekShort (unit\pathBank,pathLocation*4)
		Return tileSize*x + .5*tileSize ;align w/center of square	
	End If
End Function	

Function ReadPathY#(unit.unit,pathLocation)
	If pathLocation <= unit\pathLength
		y = PeekShort (unit\pathBank,pathLocation*4+2)
		Return tileSize*y + .5*tileSize ;align w/center of square		
	End If
End Function


;==========================================================
;COLLISION/NODE CLAIMING FUNCTIONS: These functions handle node claiming
;and collision detection (which occurs when a unit tries to claim a node that
;another unit has already claimed).

;This function checks whether the unit is close enough to the next
;path node to advance to the next one or, if it is the last path step,
;to stop.
Function CheckPathStepAdvance(unit.unit)	
	
	;If starting a new path ...
	If unit\pathLocation = 0			
		If unit\pathLength > 0 
			unit\pathLocation = unit\pathLocation+1
			ClaimNodes(unit.unit)
			ReadPath(unit) ;update xPath and yPath
		Else If unit\pathLength = 0			
			ReadPath(unit) ;update xPath and yPath
			If unit\xLoc = unit\xPath And unit\yLoc = unit\yPath
				unit\pathStatus = notstarted
				ClearNodes(unit.unit)							
			End If
		End If		
	
	;If reaching the next path node.		
	Else If unit\xLoc = unit\xPath And unit\yLoc = unit\yPath
		If unit\pathLocation = unit\pathLength 
			unit\pathStatus = notstarted
			ClearNodes(unit.unit)	
		Else
			unit\pathLocation = unit\pathLocation + 1
			ClaimNodes(unit.unit)
			ReadPath(unit) ;update xPath and yPath		
		End If	
	End If
			
End Function

;This function claims nodes for a unit. It is called by CheckPathStepAdvance().
Function ClaimNodes(unit.unit)
		
	;Clear previously claimed nodes and claim the node the unit is currently occupying.
	ClearNodes(unit.unit)
	
	;Check next path node for a collision.
	unit\unitCollidingWith.unit = DetectCollision(unit.unit)	
	
	;If no collision is detected, claim the node and figure out
	;the distance to the node.
	If unit\unitCollidingWith = Null		
		x2 = PeekShort (unit\pathBank,unit\pathLocation*4)
		y2 = PeekShort (unit\pathBank,unit\pathLocation*4+2)	
		claimedNode(x2,y2) = unit	
		ReadPath(unit.unit) ;update xPath/yPath			
		unit\distanceToNextNode = GetDistance#(unit\xLoc,unit\yLoc,unit\xPath,unit\yPath)	
	
	;Otherwise, if a collision has been detected ...
	Else		
		
		;If node is occupied by a unit not moving normally, repath.
		If unit\unitCollidingWith\pathStatus <> found			
			unit\pathStatus = FindPath(unit.unit,unit\targetX,unit\targetY)					

		;If there is a pending collision between the two units, repath.
		Else If UnitOnOtherUnitPath(unit.unit,unit\unitCollidingWith)
			unit\pathStatus = FindPath(unit.unit,unit\targetX,unit\targetY)	

		;Otherwise, just temporarily stop and wait for the other unit to pass by.	
		Else 				
			unit\pathStatus = tempStopped 									
		End If
				
	End If
		
End Function

;This function clears a unit's claimed nodes. This function is
;called principally by ClaimNodes() before new nodes are
;claimed. It is also called by CheckPathStepAdvance() when the 
;final path node is reached and by LaunchProgram() to initialize
;each unit's initial location.
Function ClearNodes(unit.unit)
	x = Floor(unit\xLoc/tileSize) : y = Floor(unit\yLoc/tileSize)
	For a = x-1 To x+1
	For b = y-1 To y+1
		If a>=0 And a<mapWidth And b>=0 And b<mapHeight
			If claimedNode(a,b) = unit Then claimedNode(a,b) = Null
		End If		
	Next
	Next
	claimedNode(x,y) = unit ;reclaim the one the unit is currently occupying.						
End Function

;This function checks to see if the next path step is free. 
;It is called from ClaimNodes() and by UpdatePath() when the
;unit is tempStopped.
Function DetectCollision.unit(unit.unit)
	x2 = PeekShort (unit\pathBank,unit\pathLocation*4)
	y2 = PeekShort (unit\pathBank,unit\pathLocation*4+2)			
	If claimedNode(x2,y2) = Null	
		x1 = Floor(unit\xLoc/tileSize)
		y1 = Floor(unit\yLoc/tileSize)	
		If x1<>x2 And y1<>y2 ;if next path step is diagonal
			If claimedNode(x1,y2) <> Null			
				If claimedNode(x1,y2) = claimedNode(x2,y1)	
					Return claimedNode(x1,y2)
				End If	
			End If								
		End If
	Else
		Return claimedNode(x2,y2)	
	End If	
End Function

;This function checks to see whether a unit is on another unit's 
;path. It is called by ClaimNodes().
Function UnitOnOtherUnitPath(unit.unit,otherUnit.unit)	
	unitX = Floor(unit\xLoc/tileSize)
	unitY = Floor(unit\yLoc/tileSize)		
	For pathLocation = otherUnit\pathLocation To otherUnit\pathLength		
		If unitX = PeekShort (otherUnit\pathBank,pathLocation*4)
			If unitY = PeekShort (otherUnit\pathBank,pathLocation*4+2)		
				Return True
			End If
		End If
		If pathLocation > otherUnit\pathLocation+1 Then Return
	Next
End Function 

;This function is used by the FindPath() function to 
;check whether the given target location is walkable.
;If not, it finds a new, nearby target location that is
;walkable. The new coordinates are written to the
;gInt1 and gInt2 global variables.
Function CheckRedirect(unit.unit, x,y)
	If NodeOccupied(unit.unit,x,y) = True
		For radius = 1 To 10
			For option = 1 To 4
				If option = 1 
					gInt1 = x : gInt2 = y-radius
				Else If option = 2 
					gInt1 = x : gInt2 = y+radius
				Else If option = 3 
					gInt1 = x-radius : gInt2 = y
				Else If option = 4 
					gInt1 = x+radius : gInt2 = y	
				End If			
				If gInt1 >= 0 And gInt1 < mapWidth And gInt2 >= 0 And gInt2 < mapHeight
					If NodeOccupied(unit.unit,gInt1,gInt2) = False Then Return succeeded ;1	
				End If
			Next
		Next
		Return failed ;unable to find redirect (returns -1).	
	End If
End Function

;This function is used by the CheckRedirect() function to 
;determine whether a given node is walkable for a given unit.
Function NodeOccupied(unit.unit,x,y)
	If walkability(x,y) <> unwalkable
		If claimedNode(x,y) = Null Or claimedNode(x,y) = unit ;node is free
			Return False
		Else ;there is another unit there
			If claimedNode(x,y)\pathStatus = found ;but if it is moving ...
				If claimedNode(x,y)<>unit\unitCollidingWith ;and unit is not colliding with it
				 	Return False
				End If
			End If	
		End If
	End If
	Return True
End Function


;This function is used by the FindPath() function to lay out
;'footprints' for other units within 1 node. FindPath() treats
;these nodes as unwalkable. 
Function CreateFootPrints(unit.unit)
	tempUnwalkable = onClosedList - 2
	unitX = Floor(unit\xLoc/tileSize) : unitY = Floor(unit\yLoc/tileSize)
	For a = unitX-1 To unitX+1
	For b = unitY-1 To unitY+1
		If a >= 0 And a < mapWidth And b>=0 And b < mapHeight
			If claimedNode(a,b) <> Null And claimedNode(a,b) <> unit
				tempUnwalkability(a,b) = tempUnwalkable
			End If			
		End If
	Next
	Next	
End Function	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久99ma| 国产最新精品精品你懂的| 久久亚洲精精品中文字幕早川悠里| 国产福利电影一区二区三区| 蜜桃av一区二区在线观看| 亚洲成av人在线观看| 亚洲色图在线视频| 亚洲日本在线a| 夜夜精品浪潮av一区二区三区| 久久久精品影视| 国产日产欧美一区| 亚洲天堂免费在线观看视频| 国产精品福利一区二区三区| 亚洲欧美日韩国产综合| 亚洲国产毛片aaaaa无费看| 亚洲午夜免费福利视频| 午夜精品爽啪视频| 毛片av一区二区三区| 韩国v欧美v亚洲v日本v| 久久国产福利国产秒拍| 国产精品一级在线| 大桥未久av一区二区三区中文| 国产精品一区不卡| 97久久精品人人澡人人爽| 欧美亚洲一区二区三区四区| 9191成人精品久久| 久久久久久日产精品| 亚洲欧美综合在线精品| 亚洲成人自拍偷拍| 久久不见久久见免费视频7| 成人午夜激情片| 欧美日韩在线不卡| 日韩欧美一区二区不卡| 久久先锋影音av鲁色资源 | 国产精品美女久久福利网站| 国产精品免费免费| 日韩精品每日更新| 成人sese在线| 久久一区二区三区国产精品| 久久亚洲二区三区| 亚洲乱码国产乱码精品精98午夜 | 亚洲国产三级在线| 国产麻豆精品在线| 欧美色精品在线视频| 久久久久久日产精品| 亚洲午夜精品一区二区三区他趣| 九九九久久久精品| 欧美综合视频在线观看| 久久午夜色播影院免费高清| 一区2区3区在线看| 国产在线精品国自产拍免费| 欧美色综合网站| 久久久国产精品午夜一区ai换脸| 亚洲电影你懂得| 激情国产一区二区| 色综合av在线| 国产精品大尺度| 国模冰冰炮一区二区| 欧美日韩国产一区二区三区地区| 国产精品网站在线观看| 高清不卡在线观看| 欧亚一区二区三区| 国产精品欧美一区二区三区| 日韩av电影免费观看高清完整版 | 日韩1区2区3区| 在线观看视频一区| 国产精品高清亚洲| 国产精品白丝jk黑袜喷水| 欧美日韩一级黄| 一区二区三区在线视频观看58| 国产麻豆成人传媒免费观看| 91精品国产乱码| 欧美成人三级在线| 精一区二区三区| 日韩精品中文字幕一区| 波多野结衣一区二区三区| 久久久久久久久久看片| 国产一区二区成人久久免费影院 | 欧美视频中文一区二区三区在线观看| 国产精品女上位| 99免费精品视频| 国产精品国产馆在线真实露脸| 成人丝袜高跟foot| 日本一区二区久久| 国产精品系列在线观看| 国产亚洲精品aa午夜观看| 国产在线乱码一区二区三区| 精品久久一区二区| 国产1区2区3区精品美女| 久久欧美中文字幕| 不卡一区二区三区四区| 亚洲精品日韩一| 欧美日韩国产片| 麻豆高清免费国产一区| 欧美mv和日韩mv的网站| 狠狠色狠狠色综合| 国产精品久久免费看| 一本色道久久综合亚洲aⅴ蜜桃| 一二三区精品视频| 欧美日韩精品一区二区三区蜜桃| 日韩黄色免费电影| 91精品国产乱| 不卡视频在线看| 亚洲国产中文字幕在线视频综合| 欧洲亚洲国产日韩| 久久成人精品无人区| 国产精品乱人伦中文| 欧美亚洲动漫精品| 国模一区二区三区白浆| 《视频一区视频二区| 欧美日韩1234| 国产伦理精品不卡| 午夜精品一区二区三区三上悠亚| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美日韩国产高清一区| 国产主播一区二区三区| 亚洲日本va午夜在线电影| 欧美人妇做爰xxxⅹ性高电影 | 亚洲日本电影在线| 日韩三区在线观看| 91麻豆精品秘密| 国产在线国偷精品产拍免费yy| 亚洲欧美电影院| 国产无一区二区| 91精品啪在线观看国产60岁| 成人av电影在线| 九色|91porny| 午夜精品久久久久久不卡8050| 久久免费电影网| 欧美喷水一区二区| 99久久综合狠狠综合久久| 日本视频免费一区| 亚洲精品五月天| 国产精品毛片大码女人| 精品成人一区二区三区四区| 欧美日韩国产影片| 色综合久久中文字幕综合网| 国产揄拍国内精品对白| 天天综合色天天综合| 亚洲女性喷水在线观看一区| 日本一区二区电影| 精品裸体舞一区二区三区| 欧美日本精品一区二区三区| 99久久99精品久久久久久| 国产福利精品导航| 国产一区二区毛片| 理论片日本一区| 青青青伊人色综合久久| 午夜电影一区二区三区| 亚洲精品中文在线| 亚洲黄色av一区| 中文字幕制服丝袜一区二区三区 | 日本不卡免费在线视频| 亚洲女子a中天字幕| 国产精品麻豆欧美日韩ww| 亚洲国产精品激情在线观看| 久久久亚洲精华液精华液精华液| 日韩久久精品一区| 欧美xxxxx牲另类人与| 日韩欧美在线影院| 91精品国产综合久久久久久久| 欧美日韩精品专区| 欧美一区二区久久| 日韩你懂的在线播放| 日韩欧美国产综合| 精品不卡在线视频| 亚洲精品在线一区二区| 26uuu欧美| 中文一区二区完整视频在线观看 | 91麻豆精品在线观看| 在线欧美日韩国产| 欧美日韩精品欧美日韩精品| 精品视频一区二区不卡| 欧美精品xxxxbbbb| 日韩免费看网站| 中文字幕高清不卡| 一区二区三区中文在线| 一区二区三区四区不卡视频 | 日韩一区二区三区av| 精品剧情v国产在线观看在线| 欧美激情资源网| 亚洲黄色免费电影| 免费观看日韩电影| 国产成人精品三级麻豆| 一本大道久久a久久精二百| 欧美日韩一区精品| 久久这里都是精品| 中文字幕一区二区不卡| 亚洲一二三区在线观看| 蜜桃视频在线观看一区二区| 成人黄动漫网站免费app| 在线观看一区日韩| 精品国产免费人成在线观看| 日本一区二区成人| 日精品一区二区三区| 国产成人小视频| 欧美精品粉嫩高潮一区二区| 国产精品大尺度| 精品一区二区三区视频| 色综合久久综合中文综合网|