所以当我尝试运行它时,我在第二个 if 语句中得到 Invalid syntax,突出显示冒号。我不明白为什么会发生这种情况,据我所知,它们基本相同。那么为什么第二个 if 语句返回无效的语法而第一个没有呢?
for event in pygame.event.get():
if event.type == MOUSEBUTTONDOWN :
if ROption1Exists == True:
rx, ry = event.pos
if rx >= (100*((X+3)+1)) and rx <= (100*((X+3)+2)) and ry >= (100*(Y+1)) and ry <= (100*(Y+2)):
print('babies')
VarReset()
Pos = ((X+3), Y)
if ROption2Exists == True:
rx, ry = event.pos
if rx >= (100*((X-3)+1)) and rx <= (100*((X-3)+2)) and ry >= (100*((Y+1)) and ry <= (100*(Y+2)):
print('babies')
VarReset()
Pos = ((X-3), Y)