示例#1
0
 def __init__(self, scene, x, y, direction):
     super().__init__(scene)
     self.position = Point(x, y)
     self.set_shape(sh.BULLET_SHAPE, Colors.bullet, True, 5)
     self.direction = direction
     self._velocity = Point.anglelen(direction, BULLET_SPEED)
     self._clamp_inside = False
示例#2
0
    def update(self):
        angl = random.uniform(0, math.pi*2)
        self._velocity += Point.anglelen(angl, ACCELERATION)
        self._velocity *= SPEED / self._velocity.length()
        self.position += self._velocity
        self.direction += ANGULAR_SPEED

        w = self.scene_manager.window_size()
        if self.position.x < 0 or self.position.x > w[0]:
            self._velocity.x *= -1
        if self.position.y < 0 or self.position.y > w[1]:
            self._velocity.y *= -1

        super().update()
示例#3
0
 def __init__(self, scene, x, y):
     super().__init__(scene, x, y)
     angl = random.uniform(0, math.pi*2)
     self._velocity = Point.anglelen(angl, SPEED)
     self.set_shape(sh.PINWHEEL_SHAPE, Colors.dumb, True, 5)