I am trying to make a game. In my game there is a shop and a fight mode. When I use collidepoint()
, and if collidepoint()
is True
, then it calls a function. But when I call the function the window says, not reponding. I can't figure out this problem, I hope you can fix it.
def lvl1():
screen.blit(stickmanlvlim,(0,0))
pygame.display.update()
def lvl2():
screen.blit(stickmanlvlim,(0,0))
pygame.display.update()
def lvl3():
screen.blit(stickmanlvlim,(0,0))
pygame.display.update()
def fight(events):
lvl1R = pygame.Rect((20,335),(50,50))
lvl2R = pygame.Rect((170,335),(50,50))
lvl3R = pygame.Rect((320,335),(50,50))
world1setup()
fight = True
while fight:
for event in events:
if event.type == pygame.QUIT:
fight = False
if event.type == pygame.MOUSEBUTTONDOWN:
spot2 = pygame.mouse.get_pos()
if lvl1R.collidepoint(spot2):
lvl1()
if lvl2R.collidepoint(spot2):
lvl2()
if lvl3R.collidepoint(spot2):
lvl3()
The problem is in the fight()
function. There is no error.
question from:
https://stackoverflow.com/questions/65848438/my-pygame-window-says-not-responding-when-i-use-collidepoint 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…