python中的循环不更新
看到即将到来的数字,
while keyboard.is_pressed('q') == False:
if pyautogui.locateCenterOnScreen('Pipe.png', confidence = 0.7) != None:
pipePos = pyautogui.locateCenterOnScreen('Pipe.png', confidence = 0.7)
PipeYpos = pipePos.y
print(pipePos)
print("I can see it The Pipe")
t = 1
else:
print("I am unable to see it The Pipe")
t = 0
if pyautogui.locateCenterOnScreen('BirdV2.png', confidence = 0.5) != None:
birdpos = pyautogui.locateCenterOnScreen('BirdV2.png', confidence = 0.5)
birdyPos = birdpos.y
print(birdpos)
print("I can see it The Bird")
t = 1
else:
print("I am unable to see it The BIRD")
t = 0
当循环获得birdypos> = pipeypos时,我的时循环不更新,在这里
while birdyPos >= PipeYpos and keyboard.is_pressed('q') == False and t == 1 and PipeYpos != 0:
print("Pipe > bird")
click(1384 ,1235)
birdyPos = 0
PipeYpos = 0
它不会忘记
它会继续前进 我希望它停止并确保数字正确并再次循环
my while loop not updating and see the up coming numbers
while keyboard.is_pressed('q') == False:
if pyautogui.locateCenterOnScreen('Pipe.png', confidence = 0.7) != None:
pipePos = pyautogui.locateCenterOnScreen('Pipe.png', confidence = 0.7)
PipeYpos = pipePos.y
print(pipePos)
print("I can see it The Pipe")
t = 1
else:
print("I am unable to see it The Pipe")
t = 0
if pyautogui.locateCenterOnScreen('BirdV2.png', confidence = 0.5) != None:
birdpos = pyautogui.locateCenterOnScreen('BirdV2.png', confidence = 0.5)
birdyPos = birdpos.y
print(birdpos)
print("I can see it The Bird")
t = 1
else:
print("I am unable to see it The BIRD")
t = 0
here is the problem
while birdyPos >= PipeYpos and keyboard.is_pressed('q') == False and t == 1 and PipeYpos != 0:
print("Pipe > bird")
click(1384 ,1235)
birdyPos = 0
PipeYpos = 0
when the loop get the birdyPos >= PipeYpos it wouldn't forget
it will keep going
i want it to stop and make sure the numbers are correct and looping again
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论