Esempio n. 1
0
class _PlayerAnimation(Layer):
    def __init__(self, R):
        super(_PlayerAnimation, self).__init__()
        self.R = R
        self.SamplePlayer = Sprite(self.R.PLAYERANIME[0])
        self.SamplePlayer.scale = 0.5
        self.size = director.get_window_size()
        #SIMPLE ANIMATION
        _WH = self.SamplePlayer.get_AABB()
        _place = (-_WH.width, self.size[1] - 120)
        _move = MoveBy((self.size[0] + (_WH.width * 2), 0), 3)
        self.SamplePlayer.do(Repeat(Place(_place) + _move))
        self.add(self.SamplePlayer)
Esempio n. 2
0
def get_sprite_box(sprite: Sprite):
    aabb = sprite.get_AABB()
    global_bl = sprite.parent.point_to_world(aabb.bottomleft)
    global_tr = sprite.parent.point_to_world(aabb.topright)
    return rect.Rect(*global_bl, *(global_tr - global_bl))