EndIf tempHigh = PlayerY Gosub GetFloor PlayerFloor = tempFloor EndIf Return GetPlayerInfo //得到蓝球信息 Sub GetBallInfo VBSCall FindColorEx(GameLeft, GameTop + 55, GameRight, GameButtom - 60, BallColor, 0, 0.9, BallX, BallY) Delay 1 If BallY>0 tempHigh = BallY + 20 Gosub GetFloor BallFloor = tempFloor EndIf //吃蓝是特殊情况 --因为在最右边,要想吃的话,得从左边上去。中间会导致找不到蓝球。所以强制置X坐标 If BallFloor = 4 and BallY < 0 BallX = GameRight EndIf Return GetPlayerInfo //得到所在的层数 Sub GetFloor If tempHigh > GameTop + 250 tempFloor = 0 ElseIf tempHigh > GameTop + 170 tempFloor = 1 ElseIf tempHigh > GameTop + 110 tempFloor = 2 ElseIf tempHigh > GameTop + 80 tempFloor = 4 ElseIf tempHigh > GameTop + 50 tempFloor = 3.5 EndIf Return GetFloor //走向怪物 Sub MoveToMon GameState = -1 If MonX > 0 and PlayerX > 0 GameState = 0 FloorDis = MonFloor - PlayerFloor //如果玩家高度高于怪物,先移动到怪物的下面 If FloorDis < 0 and (NearMon = 0 or tempFloorDis <> FloorDis) tempFloorDis = FloorDis NearMon = 1 Gosub JudgeMoveDir //如果怪物处在第四层,特殊处理 ElseIf MonFloor = 4 If FloorDis < 3.5 If PlayerFloor = 1 //我已在第一层了判断是否接近边缘 --判断用什么方式攻击怪物 VBSCall FindColorEx(PlayerX + 48, PlayerY - 120, PlayerX + 55, PlayerY - 110, FloorColor, 0, 0.8, FlooX, FlooY) If FlooX > 0 Gosub StopMove If Abs(MonX - PlayerX) >= AttackMaxDis GameState = 2 Else GameState = 1 EndIf Else If Abs(MonX - PlayerX) >= AttackMaxDis Gosub JudgeMoveDir Else Gosub StopMove GameState = 1 EndIf EndIf Else If Abs(MonX - PlayerX) >= AttackMaxDis Gosub JudgeMoveDir Else Gosub StopMove GameState = 1 EndIf EndIf Else tempLeftDis = 0 : tempRightDis = 0 tempTopDis = -90: tempButtomDis = 0: tempXDis = 65 //在最底层,则找到第一层相对于玩家的位置 Gosub JudgeFloorPos EndIf //玩家与怪物的高度小于3格,在最大攻击距离内跳砍就能打到 ElseIf FloorDis >= 0 and FloorDis <> 3 //如果玩家和怪的X距离大于最大攻击距离 If (((Abs(MonX - PlayerX) >= AttackMaxDis) and (FloorDis < 3)) or ((Abs(MonX - PlayerX) >= 20) and (FloorDis > 3))) Gosub JudgeMoveDir Else Gosub StopMove GameState = 1 EndIf EndIf ElseIf NearMon = 1 Gosub StopMove EndIf Return MoveToMon //向目标移动 Sub JudgeMoveDir KeyUp 39, 1 KeyUp 37, 1 If MonX > PlayerX KeyDown 39, 1