def __init__(self): super(TestLayer, self).__init__() x, y = director.get_window_size() self.sprite1 = Sprite('grossini.png', (x // 4, y // 2)) self.add(self.sprite1) self.sprite2 = Sprite('grossini.png', ((x // 4) * 3, y // 2)) self.add(self.sprite2) self.sprite1.do(Accelerate(Speed(Rotate(360, 1), 0.1), 4)) self.sprite2.do(Speed(Accelerate(Rotate(360, 1), 4), 0.1))
def __init__(self): super(TestLayer, self).__init__() x, y = director.get_window_size() self.sprite = Sprite('grossini.png', (x // 2, y // 2)) self.add(self.sprite) self.sprite.do(Accelerate(Rotate(360, 10), 4))
def show_message(self, msg, callback=None): w, h = director.get_window_size() self.msg = Label(msg, font_size=52, font_name='Arial', anchor_y='center', anchor_x='center') self.msg.position = (w // 2.0, h) self.add(self.msg) actions = Accelerate(MoveBy((0, -h / 2.0), duration=0.5)) + \ Delay(1) + \ Accelerate(MoveBy((0, -h / 2.0), duration=0.5)) + \ Hide() if callback: actions += CallFunc(callback) self.msg.do(actions)