How to use the ppb.Vector function in ppb

To help you get started, we’ve selected a few ppb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pathunstrom / game-tutorial / hack-and-slash-tutorial / samples / 4-main.py View on Github external
def __init__(self, engine, background_color=(0, 0, 0), **kwargs):
        super().__init__(engine=engine,
                         background_color=background_color,
                         **kwargs)
        Player(self, Vector(750, 750))
github pathunstrom / game-tutorial / hack-and-slash-tutorial / samples / 4-main.py View on Github external
def __init__(self, scene, target=None):
        super().__init__(scene.groups["player"])
        self.image = image.load(path.join(path.dirname(__file__),
                                          "player.png"))
        self.rect = self.image.get_rect()
        self.position = Vector(*self.rect.center)
        self.scene = scene
        self.target = target
        self.speed = 60
        self.reach = hypot(0.5 * self.image.get_height(), 0.5 * self.image.get_width())
github pathunstrom / game-tutorial / hack-and-slash-tutorial / samples / 7-main.py View on Github external
def respond(self):
        mouse_buttons = mouse.get_pressed()
        mouse_position = mouse.get_pos()
        if mouse_buttons[0] and not self.button_pressed:
            self.button_pressed = True
            target = EmptyTarget(Vector(*mouse_position))
            for sprite in self.targets.sprites():
                if sprite.rect.collidepoint(mouse_position):
                    target = sprite
                    break
            self.player.target = target
        if not mouse_buttons[0] and self.button_pressed:
            self.button_pressed = False
github pathunstrom / game-tutorial / hack-and-slash-tutorial / samples / 7-main.py View on Github external
def __init__(self, scene, target: TargetABC=None):
        super().__init__(scene.groups["player"])
        self.image = image.load(path.join(path.dirname(__file__),
                                          "player.png"))
        self.rect = self.image.get_rect()
        self.position = Vector(*self.rect.center)
        self.scene = scene
        self._target = target
        self.speed = 120
        self.reach = hypot(0.5 * self.image.get_height(),
                           0.5 * self.image.get_width())
github pathunstrom / game-tutorial / hack-and-slash-tutorial / samples / 7-main.py View on Github external
def __init__(self, engine, background_color=(0, 0, 0), **kwargs):
        super().__init__(engine=engine,
                         background_color=background_color,
                         **kwargs)

        chest = ClosedChest(self, Vector(750, 750))
        player = Player(self, chest)
        self.groups["terrain"].empty()

        self.controller = Controller(player, self.groups["interact"])

ppb

An Event Driven Python Game Engine

Artistic-2.0
Latest version published 11 months ago

Package Health Score

72 / 100
Full package analysis