Exemplo n.º 1
0
    def _welcome_message(self):
        Console.cls()
        print("PyPong v0.1")
        print("===========\n\n")

        if self._stats is not None:
            print("Welcome {} (wins: {}, loses: {})".format(
                self._stats.name,
                self._stats.get_wins(),
                self._stats.get_loses()
            ))
Exemplo n.º 2
0
    def run(self):
        last_time = Time.now()

        while self._scenes.count() > 0:
            this_time = Time.now()
            dt = Time.interval_as_float(this_time - last_time)
            last_time = this_time

            top_scene = self._scenes.get_scene(-1)  # get last scene
            if top_scene.is_stackable():
                for scene_index in range(self._scenes.count()):
                    current_scene = self._scenes.get_scene(scene_index)
                    if current_scene.is_stack_usable() or current_scene == top_scene:
                        self._process_scene(current_scene, dt, scene_index)
            else:
                scene_index = self._scenes.count() - 1
                last_scene = self._scenes.get_scene(scene_index)
                self._process_scene(last_scene, dt, scene_index)

        Console.cls()