示例#1
0
    class Window(arcade.Window):
        def __init__(self):
            super().__init__(140, 140, name)
            self.curtains = Curtains(self)
            self.curtains.add_scene('scene1', Scene())

        def setup(self):
            self.curtains.set_scene('scene1')
示例#2
0
class Window(arcade.Window):
    def __init__(self):
        super().__init__(500, 500, 'Anchor')
        self.curtains = Curtains(self)
        self.curtains.add_scene('scene1', SmallScene())

    def setup(self):
        self.curtains.set_scene('scene1')
示例#3
0
class GameView(arcade.View):
    """Main application class."""
    def __init__(self, debug: Optional[bool] = False):
        super().__init__()
        self.debug = debug
        if self.debug:
            POINTS_HINT.clear()
        self.curtains = Curtains(self)
        self.curtains.add_scene('swimming_scene', DuckScene(self.debug))
        self.curtains.set_scene('swimming_scene')
        arcade.set_background_color(arcade.color.WARM_BLACK)

    def on_key_release(self, symbol: int, modifiers: int) -> None:
        """
        For use only when debug=True.

        'a' to add a duck
        'p' to print the generated points_hint list
        'x' to clear the points
        """
        if not self.debug:
            return
        if symbol == ord('a'):
            if self.curtains.current_scene == self.curtains.scenes[
                    'swimming_scene']:
                self.curtains.current_scene.add_a_ducky()
        elif symbol == ord('p'):
            print(POINTS_HINT)
        elif symbol == ord('x'):
            POINTS_HINT.clear()

    def on_mouse_release(self, x: float, y: float, button: int,
                         modifiers: int) -> None:
        """Add clicked point to points_hint as % of width/height."""
        POINTS_HINT.append((round(x / self.window.width,
                                  3), round(y / self.window.height, 3)))
示例#4
0
class Window(arcade.Window):
    def __init__(self):
        super().__init__(500, 500, 'move')
        self.curtains = Curtains(self)
        self.dispatcher = get_state()
        self.curtains.add_scene('scene1', SmallScene())
        self.curtains.add_scene(
            'victory',
            ResultScene(message='You Win :)', color=arcade.color.GREEN))
        self.curtains.add_scene(
            'defeat', ResultScene(message='You Lose :(',
                                  color=arcade.color.RED))

    def setup(self):
        self.curtains.set_scene('scene1')

    def update(self, delta):
        self.dispatcher.update(delta)
class RotatingArcsSaver(arcade.Window):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.curtains = Curtains(self)
        self.curtains.add_scene('single', SingleScene(self))
        self.curtains.set_scene('single')