and the bright color version completely paints over the normal button color this will make it look like the button is slowly brightening up the brightening up is the first half of the animation the second half is the button dimming this is done with the same codeexcept that instead of the alpha value increasing for each frameit will be decreasing as the alpha value gets lower and lowerthe bright color painted on top will become more and more invisibleuntil only the original board with the dull colors is visible to do this in codeline creates copy of the display surface object and stores it in origsurf line creates new surface object the size of single button and stores it in flashsurf the convert_alpha(method is called on flashsurf so that the surface object can have transparent colors drawn on it (otherwisethe alpha value in the color objects we use will be ignored and automatically assumed to be in your own game programsif you are having trouble getting color transparency to workmake sure that you have called the convert_alpha(method on any surface objects that have transparent colors painted on them line creates individual local variables named rgand to store the individual rgb values of the tuple stored in flashcolor this is just some syntactic sugar that makes the rest of the code in this function easier to read before we begin animating the button flashline will play the sound effect for that button the program execution keeps going after the sound effect has started to playso the sound will be playing during the button flash animation for startendstep in (( )( - ))animation loop for alpha in range(startendanimationspeed step)checkforquit(displaysurf blit(origsurf( )flashsurf fill((rgbalpha)displaysurf blit(flashsurfrectangle topleftpygame display update(fpsclock tick(fpsdisplaysurf blit(origsurf( )remember that to do the animationwe want to first draw the flashsurf with color that has increasing alpha values from to to do the brightening part of the animation then to do the dimmingwe want the alpha value to go from to we could do that with code like thisfor alpha in range( animationspeed)brightening checkforquit(displaysurf blit(origsurf( )flashsurf fill((rgbalpha)displaysurf blit(flashsurfrectangle topleftemail questions to the authoral@inventwithpython com