def handle(self, event):
if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONDOWN or event.type == pygame.MOUSEBUTTONUP:
self.on_mouse_over()
pos = [event.pos[0] - self.mainloop.game_board.layout.score_bar_pos[0], event.pos[1]]
for each in self.elements:
if each.rect.topleft[0] + each.rect.width >= pos[0] >= each.rect.topleft[0] and each.rect.topleft[
1] + each.rect.height >= pos[1] >= each.rect.topleft[1]:
each.handle(event)
else:
pass
评论列表
文章目录