So im trying to remake a simple card game in pygame. Im trying to make it where whenever you hover over a card it will turn slightly transparent by changing the alpha of the card.
However I can't seem to get this to work and im genuinely confucious as to why my code doesnt work.
while running:
mX, mY = pygame.mouse.get_pos()
if 50 + 60 > mX > 50 and 500 + 84 > mY > 500:
hand[0].set_alpha(100)
else:
hand[0].set_alpha(255)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
#Hover()
if printHand:
#print(hand)
#print(cardSize)
#print(hand[0].get_width())
#print(hand[0].get_height())
#print(hand[0].get_rect(center=(80, 542)))
printHand = False
if displayHand:
DisplayHand(hand)
DisplayBoard(pile1)
DisplayBoard(pile2)
displayHand = False
print(50 + 60 > mX > 50 and 500 + 84 > mY > 500)
pygame.display.update()
Where hand is an array of surfaces from image.load
As of right now this code doesnt do anything but the print statement at the end returns true