Beispiel #1
0
def main():
    print description
    director.init(resizable=True)
    main_scene = Scene()

    back = BackgroundLayer()
    sprite = SpriteLayer()

    main_scene.add(back, z=0)
    main_scene.add(sprite, z=1)

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    sprite.do(Waves3D(duration=4) + Flip(duration=4))
    back.do(ShuffleTiles(duration=3, grid=(16, 12)))
    director.run(main_scene)
Beispiel #2
0
def main():
    print(description)
    director.init(resizable=True)
    main_scene = Scene()

    red = ColorLayer(255, 0, 0, 128)

    sprite = SpriteLayer()

    red.scale = 0.75

    main_scene.add(red, z=0)
    main_scene.add(sprite, z=1)

    sprite.do(Waves3D(duration=2) + Flip(duration=2))
    director.run(main_scene)
Beispiel #3
0
        sprite1 = Sprite('grossini.png')
        sprite2 = Sprite('grossinis_sister1.png')
        sprite3 = Sprite('grossinis_sister2.png')

        sprite1.position = (400, 240)
        sprite2.position = (300, 240)
        sprite3.position = (500, 240)

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


if __name__ == "__main__":
    print 'you shall see an scaled red background and fliping sprites. the background always must be seen (scaled)'
    director.init(resizable=True)
    main_scene = Scene()

    red = ColorLayer(255, 0, 0, 128)

    sprite = SpriteLayer()

    red.scale = 0.75

    main_scene.add(red, z=0)
    main_scene.add(sprite, z=1)

    sprite.do(Waves3D(duration=4) + Flip(duration=4))
    director.run(main_scene)
        self.add(sprite)

        jump = JumpBy((50, 100), duration=2)

        sprite.do(Repeat(Reverse(jump) + jump))


class MultiActions(cocos.layer.Layer):
    def __init__(self):
        super(MultiActions, self).__init__()

        sprite = cocos.sprite.Sprite('icon.jpg')

        sprite.position = 240, 320
        sprite.scale = 0.3
        self.add(sprite)

        # action1 = Accelerate(MoveBy( (100, 100), duration=3 ), rate=3)
        # action2 = RotateBy( 360, 5 ) * 2
        # action3 = JumpBy( (-200, -300), duration=2 )
        #
        # actions = action1 + (action2 | action3)
        #
        # sprite.do(Repeat(action=actions))


cocos.director.director.init()
main_scene = cocos.scene.Scene(MultiActions())
action = AccelAmplitude(Waves3D(waves=4, amplitude=40, duration=6), rate=1.0)
main_scene.do(action=action)
cocos.director.director.run(main_scene)