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

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

?? astarlibrary - demo 4a (loop based).bb

?? A STAR 算法源碼, 比較初級的算法, 適合初學的朋友研究
?? BB
?? 第 1 頁 / 共 2 頁
字號:

	End If ;If not already on the open list				
	End If ;If corner = walkable
	End If ;If not occupied by a stopped unit
	End If ;If not an adjacent, temporarily unwalkable node
	End If ;If not a wall/obstacle cell.	
	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

;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 (unit\xLoc = unit\xPath And unit\yLoc = unit\yPath) Or unit\pathLocation = 0		
		If unit\pathLocation = unit\pathLength 
			unit\pathStatus = notstarted
			ClearNodes(unit.unit)	
		Else If unit\pathLocation < unit\pathLength 		
			unit\pathLocation = unit\pathLocation + 1
			ClaimNodes(unit.unit)
			ReadPath(unit) ;update xPath and yPath
		End If	
	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 claims nodes for a unit. It is called by ReadPath()
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
	If unit\unitCollidingWith = Null		
		x2 = PeekShort (unit\pathBank,unit\pathLocation*4)
		y2 = PeekShort (unit\pathBank,unit\pathLocation*4+2)	
		claimedNode(x2,y2) = unit				
	
	;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)
			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 in 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 whether a unit has reached the next
;path node (true) or is between nodes (false).
Function ReachedNextPathNode(unit.unit)
	If unit\pathStatus <> found Then Return True	
	If unit\xLoc = unit\xPath And unit\yLoc = unit\yPath Then Return True	
	Return False
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() functions. 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一区二区三区免费野_久草精品视频
国产精品毛片久久久久久久| 欧美亚洲高清一区二区三区不卡| 国产精品夜夜爽| 国产成人av福利| 成人黄色软件下载| 欧美伊人久久久久久久久影院| 欧美日韩成人在线一区| 日韩一区二区免费在线电影| 欧美激情在线一区二区三区| 亚洲美女在线一区| 久久国内精品自在自线400部| 国产成人免费在线视频| 欧美三级韩国三级日本一级| 久久久99免费| 天天综合日日夜夜精品| www.欧美日韩国产在线| 亚洲精品在线免费播放| 亚洲bt欧美bt精品| av高清久久久| 国产亚洲精品中文字幕| 天天色综合天天| 色丁香久综合在线久综合在线观看| 欧美不卡视频一区| 免费成人美女在线观看| 欧美日韩精品一区二区天天拍小说 | 国产成人在线免费| 欧美成人一区二区三区片免费 | 久久综合九色综合97婷婷| 亚洲一区免费观看| 色综合久久中文综合久久97| 18欧美乱大交hd1984| 91网站在线观看视频| 欧美国产精品一区二区三区| 国产成人夜色高潮福利影视| 欧美精品一区二区三区高清aⅴ | 欧美伊人久久久久久久久影院 | 日韩一级二级三级| 蜜臀av性久久久久蜜臀aⅴ| 欧美精品在线视频| 麻豆精品新av中文字幕| 精品福利av导航| 国产69精品久久99不卡| 亚洲人成伊人成综合网小说| 欧美精品久久99| 国产福利91精品一区二区三区| 亚洲人成在线播放网站岛国 | 蜜臀a∨国产成人精品| 中文字幕av在线一区二区三区| 99久久精品国产一区| 三级久久三级久久| 国产目拍亚洲精品99久久精品| 91福利视频网站| 麻豆91在线看| 最近日韩中文字幕| 久久这里都是精品| 日本久久精品电影| 国产一区二区中文字幕| 亚洲电影视频在线| 中文字幕制服丝袜成人av| 欧美一区二区三区视频| 91热门视频在线观看| 韩国欧美国产1区| 日韩av电影免费观看高清完整版 | 国产成人在线网站| 婷婷丁香久久五月婷婷| 亚洲色图制服诱惑| 国产日韩欧美a| 中文字幕欧美国产| 国产日本欧洲亚洲| 日韩精品一区二区三区老鸭窝| 在线免费观看日韩欧美| 成人国产电影网| 国产一区福利在线| 麻豆精品精品国产自在97香蕉| 91精品国产黑色紧身裤美女| 99久久久国产精品| 高清久久久久久| 国产高清不卡二三区| 精品一区二区三区在线视频| 国产欧美日韩久久| 久久久99免费| 久久你懂得1024| 国产欧美日韩在线观看| 久久久久久亚洲综合| 欧美精品在线一区二区三区| 精品1区2区3区| 高清不卡一区二区在线| 国产一区二区精品久久99| 一区二区在线观看av| 中文字幕一区二区三区在线播放| 日韩免费在线观看| 久久综合九色综合欧美98| 久久综合色8888| 久久精品综合网| 国产精品久久久久影院色老大| 日韩一区在线看| 一区二区理论电影在线观看| 日韩精品欧美精品| 国产一区三区三区| 国产成人精品免费在线| 成人免费高清在线观看| 国产99久久精品| 色8久久人人97超碰香蕉987| 91精品国产色综合久久ai换脸 | 国产精品一区2区| 99精品欧美一区二区三区小说| 欧美丝袜丝交足nylons| 精品欧美一区二区久久| 国产精品电影一区二区| 性做久久久久久久免费看| 久久99久久久久| 色先锋久久av资源部| 欧美一级高清片| 综合亚洲深深色噜噜狠狠网站| 日韩中文字幕区一区有砖一区| 欧美日韩精品一区视频| 日韩亚洲国产中文字幕欧美| 国产精品你懂的在线欣赏| 美女性感视频久久| 日本道精品一区二区三区| 欧美日韩免费一区二区三区| 久久久国际精品| 经典一区二区三区| 91精品婷婷国产综合久久性色 | 亚洲日本电影在线| 成人一区二区在线观看| 欧美色窝79yyyycom| 国产精品妹子av| 国产91精品免费| 99久久久国产精品| 欧美日韩精品免费观看视频| 日韩福利电影在线| 26uuu国产日韩综合| 久久精品国内一区二区三区| 91精品国产一区二区三区香蕉| 亚洲第一搞黄网站| 91精品一区二区三区在线观看| 亚洲精品久久嫩草网站秘色| 色婷婷av久久久久久久| 丝瓜av网站精品一区二区 | 精品国产精品网麻豆系列 | 欧美一区二区三区小说| 亚洲大片精品永久免费| 26uuu欧美日本| 91成人国产精品| 国产精品66部| 亚洲电影一级片| 国产精品色婷婷久久58| 无码av免费一区二区三区试看| 欧美午夜影院一区| 国产91富婆露脸刺激对白| 免费在线视频一区| 国产精品夫妻自拍| 久久综合中文字幕| 欧美电影一区二区| 成人亚洲精品久久久久软件| 婷婷综合久久一区二区三区| 亚洲欧洲综合另类| 国产精品伦一区| 久久久亚洲高清| 欧美剧情片在线观看| 91麻豆6部合集magnet| 99久久精品国产观看| 91在线小视频| 国产精品888| 国产一区二区影院| 亚洲动漫第一页| 亚洲午夜三级在线| 亚洲最大成人网4388xx| 日韩一区在线看| 亚洲一区二区三区在线播放| 亚洲精品国产高清久久伦理二区| 国产精品久久毛片a| 激情综合五月天| 欧美综合视频在线观看| 99精品在线免费| 免费黄网站欧美| 免费成人在线视频观看| 制服.丝袜.亚洲.另类.中文| 91女厕偷拍女厕偷拍高清| 男女男精品网站| 久草在线在线精品观看| 无吗不卡中文字幕| 秋霞影院一区二区| 久久福利资源站| 亚洲国产精品久久艾草纯爱 | 欧美艳星brazzers| 色噜噜夜夜夜综合网| 欧洲一区二区三区在线| 欧美精品v日韩精品v韩国精品v| 欧美日产国产精品| 欧美一区二区三区四区久久| 欧美图片一区二区三区| 欧美一区二区在线免费播放| 欧美日韩一区二区三区四区 | 日韩天堂在线观看| 国产欧美精品一区aⅴ影院| 亚洲人精品午夜| 韩国一区二区在线观看| caoporm超碰国产精品|