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(TitleLayer, self).__init__() texture = pyglet.image.load('assets/textures/background.png').get_texture() background = cocos.sprite.Sprite(texture, position=(320, 240)) # background.do(Repeat(Rotate(10, 2))) self.add(background) title_label = cocos.text.RichLabel(text="Planetor", position=(320, 320), font_name="monogram", font_size=60, anchor_x="center") self.add(title_label) # menu items self.menu_items = [] self.start_label = cocos.text.RichLabel(text="Game Start", position=(320, 260), font_name="monogram", font_size=24, anchor_x="center") self.menu_items.append(self.start_label) self.add(self.start_label) self.quit_label = cocos.text.RichLabel(text="Quit Game", position=(320, 220), font_name="monogram", font_size=24, anchor_x="center") self.menu_items.append(self.quit_label) self.add(self.quit_label) self.planet = cocos.sprite.Sprite(image="assets/planet.png", position=(320, -947), color=(44, 130, 42)) self.planet.do(Repeat(Rotate(10, 5))) self.add(self.planet)
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(Reverse(Rotate(360, 5)))
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 __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.sprite2 = Sprite('grossinis_sister1.png', (0, 101)) self.sprite.add(self.sprite2) self.sprite3 = Sprite('grossinis_sister2.png', (0, 102)) self.sprite2.add(self.sprite3) self.sprite.do(Rotate(360, 10)) self.sprite2.do(ScaleBy(2, 5) + ScaleBy(0.5, 5)) self.sprite2.do(Rotate(360, 10)) self.sprite3.do(Rotate(360, 10)) self.sprite3.do(ScaleBy(2, 5) + ScaleBy(0.5, 5))
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 ) move = MoveBy((100,0), 1) rot = Rotate(360, 1) seq = Place((x/4,y/2)) + rot+move+rot+move self.sprite.do( Repeat ( seq ) )
def __init__(self): super(TestLayer, self).__init__() x, y = director.get_window_size() self.color = [127, 127, 127, 255] self.label = Label(time.ctime(), (x / 2, y / 2)) self.label.do(Rotate(360, 10)) self.add(self.label) self.schedule_interval(self.update_time, .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.sprite2 = Sprite( 'grossini.png', (x//2, y//4) ) self.add( self.sprite2 ) seq = Rotate( 360, 10 ) | MoveBy((x//2,0)) self.sprite.do( seq ) self.sprite2.do( Reverse( seq ) )
def __init__(self): super(TestLayer, self).__init__() x, y = director.get_window_size() self.color1 = [255, 0, 0, 255] self.color2 = [0, 0, 255, 255] self.label = Label('', (x // 2, y // 2)) self.label.do(Rotate(360, 10)) self.label.do( Repeat( Delay(1) + CallFunc(self.set_color, 0) + Delay(1) + CallFunc(self.set_color, 1) + Delay(1) + CallFunc(self.set_color, 2))) self.add(self.label) self.set_color(2)