I am a student trying to figure out how to make multiple clickable objects in pygame.
I was able to make 1 working clickable object (dx,dy) work, but when I tried to make another clickable object (qx,qy), every time I run my code and click on where the object should be, nothing happens.
I don't know what I am doing wrong, so it would be great if someone could give me some advice.
import pygame,sys from pygame.locals import * display = pygame.display.set_mode([1000,600]) pygame.init() clock = pygame.time.Clock() dx,dy=105,470 qx,qy=750,465 while True: for event in pygame.event.get(): if event.type==QUIT: pygame.quit() quit() elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: mouse = pygame.mouse.get_pos() if mousein range (dx,dy) and mouse in range (dx,dy+50): print("Hello love.") elif mouse in range (qx,qy+50) and mouse in range (qx,qy+50): print("No") pygame.font.init() fontcolor = pygame.Color("white") myfont = pygame.font.SysFont("Comic Sans MS",35,True,False) label1 = myfont.render("Draw Card",1,(200,200,200)) d = display.blit(label1, (dx,dy)) label2 = myfont.render("Quite",1,(200,200,200)) q = display.blit(label2, (qx,qy)) pygame.display.flip()