Ejemplo n.º 1
0
    def _create_sprites(self):
        SPEED = 0.4

        logo_image = common.load_image('scene/intro/ceferino.png')
        logo = Sprite(logo_image)
        logo.scale = 4
        logo.rotation = 180
        logo.opacity = 0
        logo.do(Place((100, 230)))
        logo.do(Delay(SPEED / 2) + 
                (FadeIn(SPEED * 2) | RotateBy(180, SPEED) | ScaleTo(1, SPEED)))

        losers_image = common.load_image('scene/intro/losers.png')
        losers = Sprite(losers_image)
        losers.position = 300, 500
        losers.rotation = 180
        losers.opacity = 0
        losers.do(Delay(SPEED) + 
                (MoveTo((300, 250), SPEED) | FadeIn(SPEED) | RotateBy(180, SPEED)))

        juegos_image = common.load_image('scene/intro/juegos.png')
        juegos = Sprite(juegos_image)
        juegos.position = 500, 0
        juegos.rotation = -180
        juegos.opacity = 0
        juegos.do(Delay(SPEED/2 * 3) +
                (MoveTo((520, 250), SPEED) | FadeIn(SPEED) | RotateBy(180, SPEED))
                + Delay(2) + CallFunc(self.skip_scene))

        self.add(logo)
        self.add(losers)
        self.add(juegos)
        self.juegos = juegos
Ejemplo n.º 2
0
    def check_queue(self, dt=0):
        width, height = cocos.director.director.get_window_size()

        image = fetch_image()
        sprite = Sprite(image)

        sprite.rotation = random.randint(-25, 25)

        end_scale = 1024.0 / image.width

        sw = int((image.width * end_scale) / 2)
        sh = int((image.height * end_scale) / 2)

        sprite.x = random.randint(sw, width - sw)
        sprite.y = random.randint(sh, height - sh)

        sprite.opacity = 0
        sprite.scale = end_scale * 1.5

        sprite.do(
            spawn(
                FadeIn(.2),
                AccelDeccel(ScaleTo(end_scale, duration=.4))) +
            Delay(15) +
            FadeOut(.5) +
            CallFunc(sprite.kill))

        self.z += 1
        self.add(sprite, z=self.z)
Ejemplo n.º 3
0
    def __init__(self):
        super(SpriteLayer, self).__init__()

        sprite1 = Sprite("grossini.png")
        sprite2 = Sprite("grossinis_sister1.png")
        sprite3 = Sprite("grossinis_sister2.png")

        sprite1.position = (320, 240)
        sprite2.position = (620, 100)
        sprite3.position = (20, 100)

        self.add(sprite1)
        self.add(sprite2)
        self.add(sprite3)

        ju_right = JumpBy((600, 0), height=100, jumps=4, duration=5)
        ju_left = JumpBy((-600, 0), height=100, jumps=4, duration=5)
        rot1 = Rotate(180 * 4, duration=5)

        sprite1.opacity = 128

        sc = ScaleBy(9, 5)
        rot = Rotate(180, 5)

        sprite1.do(Repeat(sc + Reverse(sc)))
        sprite1.do(Repeat(rot + Reverse(rot)))
        sprite2.do(Repeat(ju_left + Reverse(ju_left)))
        sprite2.do(Repeat(Reverse(rot1) + rot1))
        sprite3.do(Repeat(ju_right + Reverse(ju_right)))
        sprite3.do(Repeat(rot1 + Reverse(rot1)))
Ejemplo n.º 4
0
    def __init__(self):
        super(TestLayer, self).__init__()

        x, y = director.get_window_size()

        parent = Sprite('grossinis_sister1.png')
        self.add(parent)
        parent.position = (x // 2, y // 2)

        sprite = Sprite('grossinis_sister2.png')
        sprite.position = 100, 140
        sprite.do(RotateBy(duration=2, angle=360))
        sprite.do(ScaleBy(duration=2, scale=2))
        sprite.do(MoveBy(duration=2, delta=(200, 0)))
        parent.add(sprite)
        sprite.opacity = 128
        self.sprite1 = sprite

        sprite = Sprite('grossini.png')
        self.add(sprite)
        sprite.position = 100, 140
        sprite.do(RotateBy(duration=2, angle=360))
        sprite.do(ScaleBy(duration=2, scale=2))
        sprite.do(MoveBy(duration=2, delta=(200, 0)))

        self.sprite2 = sprite
Ejemplo n.º 5
0
    def __init__(self):
        super(SpriteLayer, self).__init__()

        sprite1 = Sprite('grossini.png')
        sprite2 = Sprite('grossinis_sister1.png')
        sprite3 = Sprite('grossinis_sister2.png')

        sprite1.position = (320, 240)
        sprite2.position = (620, 100)
        sprite3.position = (20, 100)

        self.add(sprite1)
        self.add(sprite2)
        self.add(sprite3)

        ju_right = JumpBy((600, 0), height=100, jumps=4, duration=5)
        ju_left = JumpBy((-600, 0), height=100, jumps=4, duration=5)
        rot1 = Rotate(180 * 4, duration=5)

        sprite1.opacity = 128

        sc = ScaleBy(9, 5)
        rot = Rotate(180, 5)

        sprite1.do(Repeat(sc + Reverse(sc)))
        sprite1.do(Repeat(rot + Reverse(rot)))
        sprite2.do(Repeat(ju_left + Reverse(ju_left)))
        sprite2.do(Repeat(Reverse(rot1) + rot1))
        sprite3.do(Repeat(ju_right + Reverse(ju_right)))
        sprite3.do(Repeat(rot1 + Reverse(rot1)))
Ejemplo n.º 6
0
    def __init__(self):
        super( TestLayer, self ).__init__()

        x,y = director.get_window_size()

        parent = Sprite('grossinis_sister1.png')
        self.add( parent )
        parent.position = ( x/2, y/2 )

        sprite = Sprite('grossinis_sister2.png')
        sprite.position = 100,140
        sprite.do( RotateBy( duration=2, angle=360 ) )
        sprite.do( ScaleBy( duration=2, scale=2 ) )
        sprite.do( MoveBy( duration=2, delta=(200,0) ) )
        parent.add( sprite )
        sprite.opacity = 128
        self.sprite1 = sprite

        sprite = Sprite('grossini.png')
        self.add( sprite )
        sprite.position = 100,140
        sprite.do( RotateBy( duration=2, angle=360 ) )
        sprite.do( ScaleBy( duration=2, scale=2 ) )
        sprite.do( MoveBy( duration=2, delta=(200,0) ) )

        self.sprite2 = sprite
Ejemplo n.º 7
0
 def __init__(self, layer):
     super(Light, self).__init__()
     for c in layer.get_children():
         sp = Sprite(c.image)
         sp.source_position = c.position
         sp.position = c.position
         sp.scale = c.scale
         sp.source_scale = c.scale
         sp.rotation = c.rotation
         sp.opacity = c.opacity
         sp.dx = 0
         sp.dy = 0
         sp.dt = random.random()*3.15
         self.add( sp )
Ejemplo n.º 8
0
    def on_enter( self ):
        super(SpriteFadeOut,self).on_enter()
        sprite1 = Sprite( self.image_sister1)
        sprite2 = Sprite( self.image_sister2)

        self.add( sprite1 )
        self.add( sprite2 )
        sprite1.position = 200,240
        sprite2.position = 440,240

        fadeout = FadeOut( 2 )
        fadein = FadeIn( 2 )

        sprite1.opacity = 0
        sprite1.do( fadein )
        sprite2.do( fadeout )
Ejemplo n.º 9
0
    def on_enter(self):
        super(SpriteFadeOut, self).on_enter()
        sprite1 = Sprite(self.image_sister1)
        sprite2 = Sprite(self.image_sister2)

        self.add(sprite1)
        self.add(sprite2)
        sprite1.position = 200, 240
        sprite2.position = 440, 240

        fadeout = FadeOut(2)
        fadein = FadeIn(2)

        sprite1.opacity = 0
        sprite1.do(fadein)
        sprite2.do(fadeout)
Ejemplo n.º 10
0
    def check_queue(self, dt=0):
        width, height = cocos.director.director.get_window_size()

        if self.bkg:
            self.bkg.do(
                CallFunc(self.bkg.kill)
            )

        image = fetch_image()
        sprite = Sprite(image)

        end_scale = 1024.0 / image.width * self.scale

        sw = int((image.width * end_scale) / 2)
        sh = int((image.height * end_scale) / 2)

        if random.randint(0, 1):
            sprite.x = 0
        else:
            sprite.x = width

        sprite.y = random.randint(height * .25, height * .75)

        #dst = random.randint(width*.25, width*.75), height / 2
        dst = width / 2, height / 2

        sprite.scale = end_scale * 5
        sprite.opacity = 0
        sprite.do(
            spawn(
                FadeIn(1),
                AccelDeccel(
                    spawn(
                        ScaleTo(end_scale, duration=2),
                        MoveTo(dst, duration=2)))) +
            Delay(self.interval) +
            FadeOut(.5) +
            CallFunc(sprite.kill))

        self._z += 1
        self.add(sprite, z=self._z)
Ejemplo n.º 11
0
    def __init__(self):
        super().__init__()

        try:
            sprite0 = Sprite("sp.png")
            sprite1 = Sprite("block_blue.png")
            sprite2 = Sprite("block_magenta.png")
            sprite3 = Sprite("block_yellow.png")
            sprite4 = Sprite("block_magenta.png")
            sprite5 = Sprite("block_orange.png")
        except pyglet.resource.ResourceNotFoundException:
            raise SystemExit("cannot find sprite image!")

        sprite0.position = (400, 150)
        sprite0.opacity = 0
        sprite0.do(FadeIn(2))
        self.add(sprite0)

        sprite1.position = (325, 600)
        sprite1.do(MoveTo((325, 265), 2) + JumpTo((208, 119), 200, 5, 5))
        self.add(sprite1)

        sprite2.position = (354, 600)
        sprite2.do(MoveTo((354, 265), 3) + JumpTo((412, 177), 300, 3, 3))
        self.add(sprite2)

        sprite3.position = (500, 600)
        sprite3.do(MoveTo((500, 120), 3) | (RotateBy(360, 1)) * 3)
        self.add(sprite3)

        sprite4.position = (587, 600)
        sprite4.do(
            MoveTo((587, 236), 5) | (ScaleBy(3, 2) + Reverse(ScaleBy(3, 2))))
        self.add(sprite4)

        sprite5.position = (150, 600)
        sprite5.do(MoveTo((150, 120), 3) | (RotateBy(360, 1)) * 3)
        self.add(sprite5)

        self.do(
            Delay(7) + FadeOutBLTiles(grid=(16, 12), duration=3) + StopGrid())
Ejemplo n.º 12
0
    def __init__(self):
        super(SpriteLayer, self).__init__()

        sprite0 = Sprite('eleph2.png')
        sprite1 = Sprite('eleph1.png')
        sprite2 = Sprite('eleph0.png')

        sprite0.position = (600, 360)
        sprite1.position = (1180, 100)
        sprite2.position = (20, 100)

        sprite0.scale = .5
        sprite1.scale = .5
        sprite2.scale = .5

        self.add(sprite0)
        self.add(sprite1)
        self.add(sprite2)

        ju_right = JumpBy((600, 0), height=100, jumps=8, duration=5)
        ju_left = JumpBy((-600, 0), height=100, jumps=8, duration=5)
        rot1 = Rotate(180 * 4, duration=5)

        sprite0.opacity = 128

        sc = ScaleBy(9, 5)
        rot = Rotate(180, 5)

        sprite0.do(Repeat(sc + Reverse(sc)))
        sprite0.do(Repeat(rot + Reverse(rot)))
        sprite1.do(
            Repeat(ju_left + ju_left + Reverse(ju_left) + Reverse(ju_left)))
        sprite1.do(Repeat(Reverse(rot1) + Reverse(rot1) + rot1 + rot1))
        sprite2.do(
            Repeat(ju_right + ju_right + Reverse(ju_right) +
                   Reverse(ju_right)))
        sprite2.do(Repeat(rot1 + rot1 + Reverse(rot1) + Reverse(rot1)))
Ejemplo n.º 13
0
    def __init__(self):
        super(TestLayer, self).__init__()

        x, y = director.get_window_size()

        sprite1 = Sprite("grossini.png")
        self.add(sprite1)
        sprite1.position = 300, 300

        sprite2 = Sprite("grossini.png")
        sprite1.add(sprite2)
        sprite2.position = -50, -50

        sprite3 = Sprite("grossini.png")
        sprite2.add(sprite3)
        sprite3.position = 150, 150
        sprite3.rotation = 0
        sprite3.opacity = 128

        self.sprite3 = sprite3

        sprite1.do(ScaleBy(1.5, 10))
        sprite2.do(MoveBy((100, -150), 5))
        sprite3.do(RotateBy(360, 20))
    def __init__(self):
        super( TestLayer, self ).__init__()

        x,y = director.get_window_size()

        sprite1 = Sprite('grossini.png')
        self.add( sprite1  )
        sprite1.position = 300,300

        sprite2 = Sprite('grossini.png')
        sprite1.add( sprite2  )
        sprite2.position = -50,-50

        sprite3 = Sprite('grossini.png')
        sprite2.add( sprite3 )
        sprite3.position = 150,150
        sprite3.rotation = 0
        sprite3.opacity = 128

        self.sprite3 = sprite3

        sprite1.do( ScaleBy(1.5, 10) )
        sprite2.do( MoveBy((100,-150),5) )
        sprite3.do( RotateBy(360,20) )