0

I have a start screen when you click it it will just load the game in a snap I was wondering how I could add a fade to my start screen so it looks good when you click start game

VIDeo # when you click start it just loads the game like my start menu

def game_intro(): 
        red = (200,0,0)
        green = (0,200,0)
        bright_red = (255,0,0)
        bright_green = (0,255,0)
        fps = 460
        intro = True
        while intro:
            clock.tick(fps)
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    intro = False
                    pygame.quit()
                
                    

            bks = pygame.image.load("game.png")
            window.blit(bks,(0,0))

            

            
            title5 = pygame.image.load("title.png")
            title5 = pygame.transform.scale(title5,(title5.get_width()-115,title5.get_height()-115))
            window.blit(title5,(20,100))
            # start 1
            bts1 = pygame.image.load("buts.png")
            bts1 = pygame.transform.scale(bts1,(bts1.get_width()//6,bts1.get_height()//6))

            # start 2 button
            bts2 = pygame.image.load("buts.png")
            bts2 = pygame.transform.scale(bts2,(bts2.get_width()//5,bts2.get_height()//5))



            # quit 1
            qu1 = pygame.image.load("quitbut.png")
            qu1 = pygame.transform.scale(qu1,(qu1.get_width()//6,qu1.get_height()//6))

            # quit2 2 button
            qu2 = pygame.image.load("quitbut.png")
            qu2 = pygame.transform.scale(qu2,(qu2.get_width()//5,qu2.get_height()//5))
            button("Start Game",320,380,190,60,green,bright_green,game_loop)
            button("Quit Game",330,470,180,60,green,bright_green,quitlol)

            scrollbg = pygame.image.load("scrollup.png")
            scrollbg = pygame.transform.scale(scrollbg,(scrollbg.get_width()-115,scrollbg.get_height()-115))
            window.blit(scrollbg,(220,300))    

    # make the square brighter if collideded with the buttons
            mouse = pygame.mouse.get_pos()
            if 460+120 > mouse[0] > 280 and 350+100 > mouse[1] > 350:
                window.blit(bts2,(300,280))
            else:
                window.blit(bts1,(300,300))




                # quit button
            if 450+110 > mouse[0] > 280 and 450+50 > mouse[1] > 450:
                window.blit(qu2,(300,370))
            else:
                window.blit(qu1,(300,390))
    # ---------------------------------------------------------------------





      
            pygame.display.update()


how to fade out start screen? in pygame is there any way i could add cool effects when I click start my game something like fade or when I click start game a black small circle starts and gets bigger and shows my game?

Habib Ismail
  • 21
  • 3
  • 14
  • I’m voting to close this question because it is a better fit for gamedev.stackexchange.com. – Karl Knechtel Jun 22 '20 at 01:56
  • You could overlay a black Surface over the whole screen, then change the alpha such that it becomes transparent over a "fade in" duration. – Kingsley Jun 22 '20 at 06:02
  • 1
    You can find an example [here](https://stackoverflow.com/questions/58540537/how-to-fade-the-screen-out-and-back-in-using-pygame/58541111#58541111) – sloth Jun 22 '20 at 08:13

0 Answers0