Ejemplo n.º 1
0
 def playCutscene(self, video):
     print(("play cutscene " + video))
     video_file = os.path.join(self.video_dir, video)
     if os.path.exists(video_file):
         print(video_file)
         videoplay.play(video_file, not self.parent.fullscreen)
         print("cutscene finished")
         mixer.init()
         self.initScreen()
     else:
         raise Exception("Video file " + video + "doesn't exists!")
Ejemplo n.º 2
0
def initGame(game_path, window = False, first_scene = "begin.txt", skip_intro = False):
    global gameObject
    scene_folder = os.path.join(game_path, "scenes")
    print(("Scene folder: " + scene_folder))
    if not os.path.exists(scene_folder):
        print("Missing scene folder")
        sys.exit(3)
    intro_file = os.path.join(scene_folder, "intro.txt")
    if os.path.exists(intro_file):
        lines = filehelper.readLines(intro_file)
        for line in lines:
            if line.startswith("file "):
                video_file = line[5:].strip()
                video_file = os.path.join(game_path, "videos", video_file)
                if not os.path.exists(video_file):
                    print(("Video file " + video_file + " not found!"))
                elif not skip_intro:
                    videoplay.play(video_file, window)
    pygame.init()
    if android:
        android.map_key(android.KEYCODE_BACK, pygame.K_ESCAPE)
        android.map_key(android.KEYCODE_MENU, pygame.K_F10)
    gameObject = scene.Scene(game_path, scene_folder, first_scene, window)