3

I'm new to game development and the only programming language I know is python. So I used ursina game engine, and wanted to start the game with video intro that explains what the game is about, it works but it keeps looping.

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController

app = Ursina()

# ==================================Windows===============================================

window.fullscreen_resolution = (1920, 1080)
window.fullscreen = True
window.exit_button.visible = False

#================================== menu ================================================
video = Entity(model='cube', texture='assets/ui/intro.mp4', parent=camera.ui, scale=(1.79, 1, 0))
videoaudio = Audio('assets/ui/intro.mp3')
# ================================= Hangar A =============================================

hangara = Entity(model='assets/map/hangara.fbx', collider='mesh')

app.run()

My question is how do we remove the video from the screen once it's done.

I tried doing

video = Entity(model='cube', texture='assets/ui/intro.mp4', parent=camera.ui, scale=(1.79, 1, 0), loop=False)

but it doesn't work

MattDMo
  • 100,794
  • 21
  • 241
  • 231

1 Answers1

0

You can set the video as a texture of any element.

Try it:


app = Ursina()

video = 'video.mp4'
video_player = Entity(model='quad', parent=camera.ui, scale=(1.5, 1), texture=video)
video_sound = loader.loadSfx(video)
video_player.texture.synchronizeTo(video_sound)
video_sound.play()

app.run()
robot228
  • 3
  • 1