0

I am currently creating a top down shooter in pygame and need a video as the background for my main menu. Currently I have a video that plays but it creates a new display rather than putting the video in my game menu background.

Video

class VideoWindow(App):
        def build(self):
            video = Video(source = 'MenuVideo.mp4')
            video.state = "play"
            video.options = {'eos':'loop'}
            video.allow_stretch = True
            return video

if __name__ == "__main__":
    background_menu = VideoWindow()
    background_menu.run()

Menu

def main_menu():

    click = False
    font2 = pygame.font.Font('Pixel.TTF', 64)
    keys = pygame.key.get_pressed()
    play_menu = pygame.image.load('Play.png')
    options_menu = pygame.image.load('Options.png')
    quit_menu = pygame.image.load('Quit.png')

    while True:
        draw_text = font2.render('MAIN MENU', (255, 255, 255),True)

        mx, my = pygame.mouse.get_pos()


        button1 = pygame.Rect(50, 100, 200, 50)
        button2 = pygame.Rect(50, 200, 200, 50)

        if button1.collidepoint ((mx, my)):
            if click:
                game()
        if button2.collidepoint ((mx, my)):
            if click:
                options()
        pygame.draw.rect(display, (0, 0, 139), button1)

        pygame.draw.rect(display, (0, 0, 139), button2)
        Button1text = True
        button1text_menu(ButtonX, ButtonY)

        click = False
        keys = pygame.key.get_pressed()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            if keys[pygame.K_ESCAPE]:
                pygame.quit()
                sys.exit()
            if event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 1:
                    click = True
        pygame.display.update()
        clock.tick(60)
main_menu()

1 Answers1

0

def VideoWindow(App): You are defining it as a function, I am guessing it should be a class.

Vinay Khatri
  • 312
  • 1
  • 8