def __init__(self):
        super(SportySpice2, self).__init__()
        w, h = director.get_window_size()
        l = Layer()
        demon = get_sprite('mememe_evil.jpg', w // 2, h // 2 - 270)
        demon.scale = 0.7
        demon.do(R_Blink(10, 3))
        demon.transform_anchor = 0, h // 2
        l.add(demon)
        # demon.do(R_ScaleFromTo(3, 1, 0.2))
        # self.add(demon)

        sporty = cocos.text.RichLabel("S\nP\nO\nR\nT\nY",
                                      x=w // 2,
                                      y=h // 2,
                                      font_name="November",
                                      multiline=True,
                                      width=50,
                                      color=(255, 255, 0, 255),
                                      font_size=60)

        sporty.transform_anchor = w // 2, h // 2
        sporty.rotation = -25
        sporty.position = -300, 300
        # sporty.do(R_ScaleFromTo(1, 1.3, 0.1))
        # sporty.do(Shaky3D())

        # self.add(sporty)
        l.add(sporty)
        spice = cocos.text.RichLabel("S\nP\nI\nC\nE",
                                     x=w // 2,
                                     y=h // 2,
                                     font_name="November",
                                     multiline=True,
                                     width=50,
                                     color=(255, 255, 0, 255),
                                     font_size=60)
        spice.transform_anchor = w // 2, h // 2
        spice.rotation = 30
        spice.position = 300, 300
        l.add(spice)

        # self.add(spice)
        l.transform_anchor = w // 2, h // 2 + 200

        l.do(R_ScaleFromTo(3, 1, 0.2))
        self.add(l)
class Sylwester(Scene):
    def __init__(self):
        super(Sylwester, self).__init__()

        anim = Picolo('assets/picolos.png')
        self.callbacks1 = Callbacks1(self)

        self.layer1_init()
        self.layer2_init()

        self.do(
            Repeat(
                CallFunc(self.layer1_reset) + CallFunc(self.layer1_start) +
                Delay(20) + CallFunc(self.layer2_reset) +
                CallFunc(self.layer2_start) + Delay(20)))

    def layer1_init(self):
        w, h = director.get_window_size()

        self.group1 = []
        self.l1 = Layer()
        self.l1.visible = False

        self.xds = Layer()

        for i in range(0, 18):
            xd = Line("xD " * 20, 50, (255, 255, 0, 255), w // 2, h // 2,
                      "November", pyglet.font.Text.CENTER,
                      pyglet.font.Text.CENTER)
            xd.do(Repeat(CallFunc(xd.update_line) + Delay(0.05)))
            self.xds.add(xd)

        # self.xds.do(R_Blink(10, 2))
        self.xds.do(Repeat(RotateBy(-20, 0.4)))
        self.xds.do(R_ScaleFromTo(1.2, 0.9, 0.3))
        self.l1.add(self.xds)

        self.picolos = Layer()

        for i in range(0, 370, 10):
            s = cocos.sprite.Sprite(Picolo.animation,
                                    position=(w // 2, h // 2),
                                    scale=0.8)
            s.rotation = i
            s.position = (w // 2, h // 2)
            if i == 0:
                s.scale = 0.1
            s.visible = i == 0
            self.group1.append(s)
            self.picolos.add(s)

        self.l1.add(self.picolos)

        x, y = 0 - 300, h // 2
        self.wixa1 = get_sprite('wixapol-full.png', x, y)
        self.wixa1.scale = 0.3
        self.wixa1.do(R_Blink(20, 3))
        self.l1.add(self.wixa1)

        x, y = w + 300, h // 2
        self.wixa2 = get_sprite('wixapol-full.png', x, y)
        self.wixa2.scale = 0.3
        self.wixa2.do(R_Blink(20, 3))
        self.l1.add(self.wixa2)

        self.l1.visible = False
        self.add(self.l1)

    def layer1_start(self):
        self.l1.visible = True
        self.l2.visible = False
        self.l1.resume()
        self.l2.pause()

        self.do(
            CallFunc(self.callbacks1.scale_picolo) + Delay(1) +
            CallFunc(self.callbacks1.duplicate_picolo) +
            CallFunc(self.callbacks1.center_logos))

    def layer1_reset(self):
        w, h = director.get_window_size()

        for picolo in self.group1:
            picolo.visible = False

        for k, xd in enumerate(self.xds.get_children()):
            xd.rotation = k * 10

        self.picolos.stop()
        self.picolos.rotation = 0

        self.group1[0].visible = True
        self.group1[0].scale = 0.1

        self.wixa1.position = -300, h // 2
        self.wixa2.position = w + 300, h // 2

        self.wixa1.opacity = self.wixa2.opacity = 255
        self.wixa1.scale = self.wixa2.scale = 0.3

    def layer2_init(self):
        w, h = director.get_window_size()

        self.l2 = Layer()
        self.l2.visible = False

        self.stallone = Layer()

        bg = get_sprite('jungle.jpg', w // 2, h // 2)
        bg.scale = 1.3
        bg.do(R_ScaleFromTo(2, 1.3, 0.1))
        self.stallone.add(bg)

        s = get_sprite('stallone.png', w // 2, h // 2 + 100)
        s.scale = 1.35
        s.do(Repeat(Shaky3D(randrange=2, grid=(32, 24), duration=5)))
        s.do(R_ScaleFromTo(2, 1.3, 0.2))
        self.stallone.add(s)

        self.l2.add(self.stallone)

        txt = Line("TOTALNE           ",
                   100, (255, 255, 0, 255),
                   w // 2,
                   h // 2,
                   "November",
                   anchor_x=pyglet.font.Text.CENTER,
                   anchor_y=pyglet.font.Text.CENTER)
        txt.do(Repeat(CallFunc(txt.update_line) + Delay(0.1)))
        txt.transform_anchor = w // 2, h // 2
        txt.position = -600, 0
        txt.rotation = 60
        self.l2.add(txt)

        txt = Line("ZNISZCZENIE       ",
                   100, (255, 255, 0, 255),
                   w // 2,
                   h // 2,
                   "November",
                   anchor_x=pyglet.font.Text.CENTER,
                   anchor_y=pyglet.font.Text.CENTER)
        txt.do(Repeat(CallFunc(txt.update_line) + Delay(0.1)))
        txt.transform_anchor = w // 2, h // 2
        txt.position = 600, 0
        txt.rotation = -60
        self.l2.add(txt)

        wixa = get_sprite('wixapol-full.png', 200, 250)
        wixa.scale = 0.3
        wixa.do(R_Blink(20, 3))
        self.l2.add(wixa)

        wixa = get_sprite('wixapol-full.png', w - 200, 250)
        wixa.scale = 0.3
        wixa.do(R_Blink(20, 3))
        self.l2.add(wixa)

        self.add(self.l2)

    def layer2_reset(self):
        pass

    def layer2_start(self):
        self.l2.visible = True
        self.l1.visible = False
        self.l1.pause()
        self.l2.resume()
Beispiel #3
0
class CrystalSkulls(Scene):
    def __init__(self):
        super(CrystalSkulls, self).__init__()
        w, h = director.get_window_size()

        s = get_sprite('bones.png', w // 2, h // 2)
        s.do(R_ScaleFromTo(2, 1, 0.3))
        self.add(s)

        self.l1 = Layer()

        self.l1.add(Skulls())

        s = get_sprite('wixapol.png', w // 2 - 80, h // 2 + 50)
        s.do(R_ScaleFromTo(1.2, 0.2, 0.1))
        self.l1.add(s)

        s = get_sprite('wixapol.png', w // 2 + 80, h // 2 + 50)
        s.do(R_ScaleFromTo(1.2, 0.2, 0.1))
        self.l1.add(s)

        self.l1.transform_anchor = w // 2, h // 2
        OFFSET_X = 400
        OFFSET_Y = 200
        DELAY = 0.15

        self.l1.do(
            Repeat((Place(
                (-OFFSET_X, 0)) + Delay(DELAY) + ScaleTo(1, 0.15) + Place(
                    (0, 0)) + Delay(DELAY) + ScaleTo(2, 0.15) + Place(
                        (OFFSET_X, 0)) + Delay(DELAY) + ScaleTo(1, 0.15) +
                    Place((0, 0)) + Delay(DELAY) + ScaleTo(2, 0.15) + Place(
                        (-OFFSET_X, 0)) + Delay(DELAY) + ScaleTo(1, 0.15) +
                    Place((0, 0)) + Delay(DELAY) + ScaleTo(2, 0.15) + Place(
                        (0, OFFSET_Y)) + Delay(DELAY) + Place(
                            (0, 0)) + Delay(DELAY) + Place(
                                (0, -OFFSET_Y)) + Delay(DELAY) + Place(
                                    (0, 0)) + Delay(DELAY) + Place(
                                        (0, OFFSET_Y)) + Delay(DELAY) + Place(
                                            (0, 0)) + Delay(DELAY))))

        self.l2 = Layer()
        s = get_sprite('skeleton.png', w // 2, h // 2)
        s.scale = 0.7
        s.do(
            Repeat(
                Twirl(center=(w // 2, 200),
                      grid=(16, 12),
                      duration=5,
                      twirls=6,
                      amplitude=0.5)))
        self.l2.add(s)

        for pos in ((w // 2 - 600, h // 2), (w // 2 + 600, h // 2)):
            x, y = pos
            s = get_sprite('wixapol-full.png', x, y)
            s.scale = 0.4

            s.do(
                Repeat(
                    Place((x, y - 250)) + Delay(DELAY * 2) + Place((x, y)) +
                    Delay(DELAY * 2) + Place((x, y + 250)) + Delay(DELAY * 2) +
                    Place((x, y)) + Delay(DELAY * 2)))
            s.do(R_Blink(10, 3))
            self.l2.add(s)

        self.add(self.l1)
        self.add(self.l2)

        self.is_first_layer = True

        self.do(Repeat(CallFunc(self.callback) + Delay(15)))

    def callback(self):
        self.l1.visible = self.is_first_layer
        self.l2.visible = not self.is_first_layer
        self.is_first_layer = not self.is_first_layer