Пример #1
0
    def __init__(self, x, y, batch, body, head):
        self.x, self.y = x,y

        self.body = pyglet.sprite.Sprite(body, batch=batch)
        self.head = pyglet.sprite.Sprite(head, batch=batch)

        self.getHeadTilt = make_rotator(lim_left=-10, lim_right=10)
Пример #2
0
    def custom_update(self):
        """
        Update rotation so that it is always spinning.

        """
        # gravity will spin in a random direction for visual gags.
        direction = get_or_setdefault(self, '_direction',
                                            random.choice([3, -3]))

        rotator = get_or_setdefault(self, '_rotator',
                                            make_rotator(direction))

        self.image.rotation = rotator.next()