def game_intro():
intro = True
while intro:
for event in pygame.event.get():
#print(event)
if event.type == pygame.QUIT:
pygame.quit()
quit()
gameDisplay.fill(white)
largeText = pygame.font.Font('freesansbold.ttf',115)
TextSurf, TextRect = text_objects("A bit Racey", largeText)
TextRect.center = ((display_width/2),(display_height/2))
gameDisplay.blit(TextSurf, TextRect)
mouse = pygame.mouse.get_pos()
#print(mouse)
if 150+100 > mouse[0] > 150 and 450+50 > mouse[1] > 450:
pygame.draw.rect(gameDisplay, bright_green,(150,450,100,50))
else:
pygame.draw.rect(gameDisplay, green,(150,450,100,50))
pygame.draw.rect(gameDisplay, red,(550,450,100,50))
pygame.display.update()
clock.tick(15)
The additional code is asking if the mouse is within the boundaries of the rectangle. If it is, then we use a lighter color. This of course requires a regular green and a light green to be defined.
Here are my colors at the moment:
red = (200,0,0) green = (0,200,0) bright_red = (255,0,0) bright_green = (0,255,0)