my code:
def shop_button(self):
click = pygame.mouse.get_pressed()
if click[0] == 1:
self.open_shop() # draws shop
self.inshop = True
while self.inshop:
pygame.time.delay(10)
mousepos = pygame.mouse.get_pos()
if click[0] == 1 and b.mouse_on_button(mousepos[0], mousepos[1], b.escapex, b.escapex2, b.escapey, b.escapey2):
self.inshop = False
whenever you click on the shop button this function is run, however, while self.inshop is inside an if statement like such the game instantly stops responding and crashes. This could be a very simple solution as I am semi-new to pygame and the python language as a whole. However, with that being said I can't seem to find a solution anywhere else.