当前位置: 首页>>代码示例>>Python>>正文


Python scene.Scene类代码示例

本文整理汇总了Python中cocos.scene.Scene的典型用法代码示例。如果您正苦于以下问题:Python Scene类的具体用法?Python Scene怎么用?Python Scene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Scene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_scene

def get_scene():
    global keyboard, scroller
    keyboard = key.KeyStateHandler()
    director.window.push_handlers(keyboard)

    model = Model()

    world_layer = WorldMap(2000, 2000, model)
    scroller = cocos.layer.ScrollingManager()
    scroller.add(world_layer)

    car_layer = layer.ScrollableLayer()
    car = cocos.sprite.Sprite('car.png')
    car_layer.add(car)
    car.position = (200, 100)
    # car.max_forward_speed = 200
    # car.max_reverse_speed = -100
    car.max_forward_speed = 400
    car.max_reverse_speed = -200
    car.do(DriveCar(model))
    scroller.add(car_layer)

    scene = Scene()
    scene.add(scroller)

    return scene
开发者ID:FloydaGithub,项目名称:DontCrash,代码行数:26,代码来源:GameScene.py

示例2: test_6_on_pop_calls_on_enter_on_exit

    def test_6_on_pop_calls_on_enter_on_exit(self):
        global rec
        
        scene0 = Scene()
        scene1 = Scene()

        def on_exit():
            global rec
            rec.append('on_exit_called')

        def on_enter():
            global rec
            rec.append('on_enter_called')

        scene0.on_enter = on_enter
        scene1.on_exit = on_exit
            
        rec = []
        director.on_push(scene0)
        # pyglet mockup 1 don't tickle on_draw, we call
        # directly so the push / pop operation completes
        director.on_draw()

        director.on_push(scene1)
        director.on_draw()

        rec = []
        director.on_pop()
        director.on_draw()

        assert rec[0]=='on_exit_called'
        assert rec[1]=='on_enter_called'
开发者ID:Anaphory,项目名称:cocos,代码行数:32,代码来源:test_director_scene_changes.py

示例3: start

def start():
    director.init(width=CONF.window_width,
                  height=CONF.window_height,
                  caption=CONF.caption)
    scene = Scene()
    scene.add(menu.MainMenu(), z=1)
    director.run(scene)
开发者ID:kuainiao,项目名称:game_client,代码行数:7,代码来源:game.py

示例4: reload_solitaire

def reload_solitaire(replay_file):
    gamescene = Scene()
    gamelayer = IncantusLayer()
    gamescene.add(gamelayer, z=0, name="table")
    director.push(gamescene)
    #director.push(ZoomTransition(gamescene, 1.5))
    gamelayer.game_reload(replay_file)
开发者ID:Incantus,项目名称:incantus,代码行数:7,代码来源:Incantus.py

示例5: start_solitaire

def start_solitaire(player_name, players):
    gamescene = Scene()
    gamelayer = IncantusLayer()
    gamescene.add(gamelayer, z=0, name="table")
    director.push(gamescene)
    #director.push(ZoomTransition(gamescene, 1.5))
    gamelayer.game_start(player_name, pyglet.clock.time.time(), players)
开发者ID:Incantus,项目名称:incantus,代码行数:7,代码来源:Incantus.py

示例6: setup

def setup(test=False, phase_source = None, train_end_calls = []):
    director.director.init(width=1056, height=700, caption='MatchBrain')
    scene = Scene()
    scene.add(MultiplexLayer(
        MainMenu(test, phase_source, train_end_calls),
    ), z = 1)
    return scene
开发者ID:jorenverspeurt,项目名称:MatchBrain,代码行数:7,代码来源:MatchBrain.py

示例7: main

def main():
    director.init(**resources.settings['window'])
    scene = Scene()
    scene.add(MultiplexLayer(
        MainMenu(scene),
        LevelSelectMenu(),
        OptionsMenu(),
        ScoresLayer(),
        HelpLayer(),
        AboutLayer()
    ),
        z=1)
    director.set_show_FPS(resources.settings["general"]["showFps"])
    w, h = director.get_window_size()

    # Music - moved to resources
    # 1st Try - doesnt play anything
    # scene.load_music("assets/music.wav")
    # scene.play_music()

    # 2nd Try - static noise louder than music
    # music = pyglet.resource.media("assets/music.wav", streaming = True)
    # music.play()

    # 3rd Try - music stops after ca. 1 min (even when piece was longer)
    # and doesnt repeat as it should
#    music_player = pyglet.media.Player()
#    music = pyglet.resource.media("assets/music.wav", streaming = False)
#    music_player.queue(music)
#    music_player.eos_action = music_player.EOS_LOOP
    director.run(scene)
开发者ID:faide,项目名称:pyfense,代码行数:31,代码来源:pyfense.py

示例8: main

def main():
    """
    test split layers
    """
    from cocos.scene import Scene
    from cocos.director import director

    director.init()

    window_size = director.get_window_size()
    window_rect = Rect(0, 0, *window_size)

    distance = window_size[0] * 3 / 4
    main_rect, rest_rect = split_horizontal(window_rect, distance)

    status_height = 80
    status_rect, menu_rect = split_vertical(rest_rect, status_height)

    main_layer = SplitLayer(main_rect)
    menu_layer = SplitLayer(menu_rect, color=(255, 255, 0, 255))
    status_layer = SplitLayer(status_rect, color=(255, 0, 255, 255))

    scene = Scene()
    scene.add(main_layer, z=0)
    scene.add(menu_layer, z=1)
    scene.add(status_layer, z=2)

    director.run(scene)
开发者ID:fisadev,项目名称:veronica-defense,代码行数:28,代码来源:split_layer.py

示例9: new_game

def new_game():
    director.init(resizable=False, width=1024, height=768)
    scene = Scene()
    scene.add(BackgroundLayer(), z=0)
    scene.add(MultiplexLayer(
        MainMenu(),
    ), z=1)
    director.run(scene)
开发者ID:aikikode,项目名称:pyhammerfight,代码行数:8,代码来源:menus.py

示例10: GameMenu

class GameMenu(Menu):
    def __init__(self):
        super(GameMenu, self).__init__()
        self.scene = Scene()
        self.scene.add(MultiplexLayer(MainMenu(), OptionsMenu(), KeyBindingMenu()), z=1)

    def start_game(self):
        director.run(self.scene)
开发者ID:Ecialo,项目名称:Codename-Parzalon,代码行数:8,代码来源:menu.py

示例11: menu_scene

def menu_scene():
    scene = Scene()
    scene.add(BackgroundLayer('menu_backgroud.jpg'), z=0)
    scene.add(MultiplexLayer(
        MainMenu(),
        OptionsMenu()
    ), z=1)
    return scene
开发者ID:Dront,项目名称:asteroids,代码行数:8,代码来源:asteroids.py

示例12: start_game

 def start_game(self):
     scene = Scene()
     scene.add(MultiplexLayer(
                      MainMenu(),
                      OptionsMenu(),
                      HiScoresLayer(),
                      ), z=1)
     scene.add(BackgroundLayer(), z=0)
     director.push(ShuffleTransition(scene, 1.5))
开发者ID:mcgillij,项目名称:pygauntlet,代码行数:9,代码来源:gamelayers.py

示例13: previous

    def previous():
        if SlidesManager.current_position == 0 or \
            SlidesManager.current_position-1 > len(SlidesManager.slides_pool):

            return

        SlidesManager.current_position-=1
        scene = Scene(Presentation())
        scene.add(SlidesManager.slides_pool[SlidesManager.current_position], z=1)
        director.push(scene)
开发者ID:flavioribeiro,项目名称:softwarefreedomdaycg,代码行数:10,代码来源:presentation.py

示例14: main

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)
开发者ID:1414648814,项目名称:cocos,代码行数:10,代码来源:test_SequenceScene.py

示例15: on_win

 def on_win(self):
     Objects.reset_game()
     server = Objects.get_server(self.levelName)
     server.curLevel = self.level+1
     utils.play_sound("Enter.wav")
     game = Scene(server.map, server)
     game.add(ImageLayer(os.path.join("images", "backgrounds", "notebook-paper.png")), z=BACKGROUND_Z)
     director.push(game)
     menu_player.stop()
     self.game_started = True
开发者ID:david-abel,项目名称:noteworks,代码行数:10,代码来源:game.py


注:本文中的cocos.scene.Scene类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。