Ejemplo n.º 1
0
def main():
    print(description)
    director.init( resizable=True, width=640, height=480 )
    scene_green = Scene()
    layer_green = ColorLayer(32,255,0,255)
    scene_green.add(layer_green)
    scene_green.do(ac.Delay(2.0) + ac.CallFunc(push_sequence_scene))
    # pyglet 1.1.4 needs this to timely pump actions 
    pyglet.clock.schedule(lambda dt: None)
    director.run(scene_green)
Ejemplo n.º 2
0
def main():
    print(description)
    director.init(resizable=True, width=640, height=480)
    scene_green = Scene()
    layer_green = ColorLayer(32, 255, 0, 255)
    scene_green.add(layer_green)
    scene_green.do(ac.Delay(2.0) + ac.CallFunc(push_sequence_scene))
    # pyglet 1.1.4 needs this to timely pump actions
    pyglet.clock.schedule(lambda dt: None)
    director.run(scene_green)
Ejemplo n.º 3
0
def push_sequence_scene():
    scene_blue = Scene()
    layer_blue = ColorLayer(32,32,255,255)
    scene_blue.add( layer_blue, z=0 )
    scene_blue.do(ac.Delay(2) + ac.CallFunc(pop_scene))

    scene_red = Scene()
    layer_red = ColorLayer(255,32,0,255)
    scene_red.add( layer_red, z=0 )
    scene_red.do(ac.Delay(2) + ac.CallFunc(pop_scene))

    director.push( SequenceScene(scene_blue, scene_red) )
Ejemplo n.º 4
0
def push_sequence_scene():
    scene_blue = Scene()
    layer_blue = ColorLayer(32, 32, 255, 255)
    scene_blue.add(layer_blue, z=0)
    scene_blue.do(ac.Delay(2) + ac.CallFunc(pop_scene))

    scene_red = Scene()
    layer_red = ColorLayer(255, 32, 0, 255)
    scene_red.add(layer_red, z=0)
    scene_red.do(ac.Delay(2) + ac.CallFunc(pop_scene))

    director.push(SequenceScene(scene_blue, scene_red))
Ejemplo n.º 5
0
    #  lens_effect: 0.7, a strong "lens". 0 means no effect at all. 1 means very strong
    #  center: center of the lens
    #  grid=(20,16): create a grid of 20 tiles x 16 tiles. More tiles will
    #     look better but the performance will decraese
    #  duration=10: 10 seconds
    lens = Lens3D(radius=150,
                  lens_effect=0.7,
                  center=(150, 150),
                  grid=(20, 16),
                  duration=50)

    # create a Jump action
    # Jump to the right 360 pixels doing:
    #   3 jumps
    #   of height 170 pixels
    #  in 4 seconds
    jump = JumpBy((360, 0), 170, 3, 4)

    # do and get the cloned action of lens'
    action = scene.do(lens)

    # perform the Jump action using as target the lens effect.
    # the Jump action will modify the 'position' attribute, and
    # the lens action uses the 'position' attribute as the center of the lens
    #
    # The action Jump + Reverse(Jump) will be repeated 5 times
    scene.do((jump + Reverse(jump)) * 5, target=action)

    # Run!
    director.run(scene)
Ejemplo n.º 6
0
def start():
    director.set_depth_test()

    firelayer = FireManager(director.get_window_size()[0], 250)
    spritelayer = SpriteLayer()
    menulayer = MultiplexLayer(MainMenu())

    scene = Scene(firelayer, spritelayer, menulayer)

    twirl_normal = Twirl(center=(320, 240),
                         grid=(16, 12),
                         duration=15,
                         twirls=6,
                         amplitude=6)
    twirl = AccelDeccelAmplitude(twirl_normal, rate=4.0)
    lens = Lens3D(radius=240, center=(320, 240), grid=(32, 24), duration=5)
    waves3d = AccelDeccelAmplitude(Waves3D(waves=18,
                                           amplitude=80,
                                           grid=(32, 24),
                                           duration=15),
                                   rate=4.0)
    flipx = FlipX3D(duration=1)
    flipy = FlipY3D(duration=1)
    flip = Hide(duration=1)
    liquid = Liquid(grid=(16, 12), duration=4)
    ripple = Ripple3D(grid=(32, 24),
                      waves=7,
                      duration=10,
                      amplitude=100,
                      radius=320)
    shakyt = ShakyTiles3D(grid=(16, 12), duration=3)
    corners = CornerSwap(duration=1)
    waves = AccelAmplitude(Waves(waves=8,
                                 amplitude=50,
                                 grid=(32, 24),
                                 duration=5),
                           rate=2.0)
    shaky = Shaky3D(randrange=10, grid=(32, 24), duration=5)
    quadmove = QuadMoveBy(delta0=(320, 240),
                          delta1=(-630, 0),
                          delta2=(-320, -240),
                          delta3=(630, 0),
                          duration=2)
    fadeout = FadeOutTRTiles(grid=(16, 12), duration=2)
    cornerup = MoveCornerUp(duration=1)
    cornerdown = MoveCornerDown(duration=1)
    shatter = ShatteredTiles3D(randrange=16, grid=(16, 12), duration=4)
    shuffle = ShuffleTiles(grid=(16, 12), duration=1)
    orbit = OrbitCamera(radius=1,
                        delta_radius=2,
                        angle_x=0,
                        delta_x=-90,
                        angle_z=0,
                        delta_z=180,
                        duration=4)
    jumptiles = JumpTiles3D(jumps=2, duration=4, amplitude=80, grid=(16, 12))
    wavestiles = WavesTiles3D(waves=3, amplitude=60, duration=8, grid=(16, 12))
    turnoff = TurnOffTiles(grid=(16, 12), duration=2)

    scene.do(
        Delay(3) + ripple + Delay(2) + wavestiles + Delay(1) + twirl + liquid +
        Delay(2) + shakyt + Delay(2) + ReuseGrid() + shuffle + Delay(4) +
        ReuseGrid() + turnoff + Reverse(turnoff) + Delay(1) + shatter + flip +
        Delay(2) + Reverse(flip) + flipx + Delay(2) + ReuseGrid() + flipy +
        Delay(2) + ReuseGrid() + flipx + Delay(2) + ReuseGrid() + flipy +
        Delay(2) + lens + ReuseGrid() + ((orbit + Reverse(orbit)) | waves3d) +
        Delay(1) + corners + Delay(2) + Reverse(corners) + waves + Delay(2) +
        ReuseGrid() + shaky + jumptiles + Delay(1) + cornerup + Delay(1) +
        Reverse(cornerdown) + Delay(1) + fadeout + Reverse(fadeout) +
        Delay(2) + quadmove + Delay(1) + Reverse(quadmove) + StopGrid())

    scene.do(Delay(10) + OrbitCamera(delta_z=-360 * 3, duration=10 * 4))

    firelayer.do(Delay(4) + Repeat(RotateBy(360, 10)))

    return scene
Ejemplo n.º 7
0
    scene = Scene(BackgroundLayer())

    # create a Lens effect action
    #  radius: 150 pixels
    #  lens_effect: 0.7, a strong "lens". 0 means no effect at all. 1 means very strong
    #  center: center of the lens
    #  grid=(20,16): create a grid of 20 tiles x 16 tiles. More tiles will
    #     look better but the performance will decraese
    #  duration=10: 10 seconds
    lens = Lens3D(radius=150, lens_effect=0.7, center=(150, 150), grid=(20, 16), duration=50)

    # create a Jump action
    # Jump to the right 360 pixels doing:
    #   3 jumps
    #   of height 170 pixels
    #  in 4 seconds
    jump = JumpBy((360, 0), 170, 3, 4)

    # do and get the cloned action of lens'
    action = scene.do(lens)

    # perform the Jump action using as target the lens effect.
    # the Jump action will modify the 'position' attribute, and
    # the lens action uses the 'position' attribute as the center of the lens
    #
    # The action Jump + Reverse(Jump) will be repeated 5 times
    scene.do((jump + Reverse(jump)) * 5, target=action)

    # Run!
    director.run(scene)