0

I've got a problem. I'm creating the Game Menu which i want to be:

  1. background as video file (using MoviePy)
  2. buttons on the video

The problem is video is showing, but the button1 not. Please help...

from moviepy.editor import *
import pygame
from pygame import mixer
import os
import cv2
print(os.getcwd())

# Initialization the PyGame
pygame.init()

# Create the screen
WIN = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)

# Menu Background
background = pygame.image.load('Assets/background.png')
button1 = pygame.image.load('Assets/button.png')


# Background SOUND
mixer.music.load('Assets/mainmenumusic.mp3')
mixer.music.set_volume(0.2)
mixer.music.play(-1)

# Game TITLE and ICON
pygame.display.set_caption("Game Launcher") # title of the game
icon = pygame.image.load('Assets/icon.png') # define the icon variable
pygame.display.set_icon(icon) # set the window icon to the icon variable

# FPS Lock
FPS = 60



clip = VideoFileClip('Assets/particles.mp4', audio=False)

# Game loop
clock = pygame.time.Clock()
running = True
while running:
    clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
    WIN.blit(button1, (960, 540))
    clip.preview(fullscreen=True)
    pygame.display.update()
MegaIng
  • 7,361
  • 1
  • 22
  • 35
Hajp
  • 1
  • 1

1 Answers1

0

The button is not showing because you blit it before the background video so the video covers it. You can just try with:

clip.preview(fullscreen=True)
WIN.blit(button1, (960, 540))
Matteo
  • 66
  • 1
  • 7