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


Python scene.Scene类代码示例

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


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

示例1: __init__

 def __init__(self, world, initial_option=0):
     Scene.__init__(self, world)
     items=[]
     for name,level in levels.levels:
         items.append( (name, runner(self.game, level) ) )
     items.append( ("back", self.on_back) )
     self.menu = Menu(self, items, initial_option)
开发者ID:ricardoquesada,项目名称:pywii,代码行数:7,代码来源:main_menu.py

示例2: __init__

 def __init__(self):
   Scene.__init__(self)
   self._screen = Screen()
   self._player = PlayerCharacter()
   self._floor = CurrentFloor()
   self._sight = Sight(self._player)
   self._floor.put_monster(Monster())
开发者ID:bucho666,项目名称:RogueLikePrototype,代码行数:7,代码来源:dungeon.py

示例3: __init__

 def __init__(self, line_num, *args, **kwargs):
     self.line_num = line_num
     self.anim_kwargs = {
         "run_time" : 4.0,
     }
     self.line_num_to_method = {
         0  : self.line0,
         1  : self.line1,
         2  : self.line2,
         3  : self.line3,
         4  : self.line4,
         5  : self.line5,
         6  : self.line6,
         7  : self.line7,
         8  : self.line8,
         9  : self.line9,
         10 : self.line10,
         11 : self.line11,
         12 : self.line12,
         13 : self.line13,
         14 : self.line14,
         15 : self.line15,
         16 : self.line16,
         17 : self.line17,
         18 : self.line18,
         19 : self.line19,
     }
     Scene.__init__(self, *args, **kwargs)
开发者ID:mherkazandjian,项目名称:manim,代码行数:28,代码来源:tau_poem.py

示例4: __init__

    def __init__(self, gurls, bg_surf=None, back_color=(234,45,30), back_pos=(40,500),
                 back_size=(70,40), back_font=None):
        Scene.__init__(self)
        self.gurls = gurls  # expect three
        self.bg_surf = bg_surf
        self.done = False
        self.choice = None

        def finish():
            self.done = True
        self.buttons.add(BlockButton(finish, back_color, back_size, back_pos,
                                     text="Back", font=back_font))
        self.gurl_sprites = pygame.sprite.Group()
        gurl_pos = [(100, 100), (300, 100), (500, 100)]

        def make_choice(gurl):
            self.done = True
            self.choice = gurl

        def make_gurl_sprite(gurl):
            pos = gurl_pos.pop(0)
            sprite = GurlSprite(gurl, pos)
            sprite.on_click = lambda: make_choice(gurl)
            self.gurl_sprites.add(sprite)

        make_gurl_sprite(Kanaya())
        make_gurl_sprite(Isadora())

        self.buttons.add(self.gurl_sprites)
        self.all_sprites.add(self.buttons, self.gurl_sprites)
        self.main_surface = pygame.display.get_surface()
开发者ID:andychau,项目名称:datingsim,代码行数:31,代码来源:initiatemeet.py

示例5: PyAgar

class PyAgar(object):
    title = "PyAgar"
    def __init__(self, args):
        self.args = args

        pyglet.resource.path.append(os.path.join(dname,'resources'))
        pyglet.resource.reindex()
        pyglet.font.add_file('resources/DejaVuSans.ttf')
        pyglet.font.add_file('resources/unifont.ttf')

        director.set_show_FPS(False)
        w = director.init(fullscreen=True, caption=self.title, visible=True, resizable=True)

        # width = director.window.width
        # height = director.window.height
        # wnew, hnew = int(width * .75), int(height * .75)
        # director.window.set_fullscreen(False)
        # director.window.set_size(wnew, hnew)
        # w.set_location((width-wnew)/2, (height-hnew)/2)

        director.window.pop_handlers()
        director.window.push_handlers(Handler())

        self.gameScene = Scene()
        self.gameLayer = AgarLayer()
        self.gameScene.add(self.gameLayer)

        director.replace(self.gameScene)

        director.window.set_visible(True)
开发者ID:RyanHope,项目名称:pyagar,代码行数:30,代码来源:main.py

示例6: test_each_player_is_positioned_on_a_different_block

 def test_each_player_is_positioned_on_a_different_block(self):
     scene = Scene(self.get_surface())
     # Add as many player as the number of blocks scene has
     for player in [Player() for _ in range(scene.block_count)]:
         scene.add_player(player)
     self.assertEqual(len(scene.player_positions), scene.block_count)
     self.assertEqual(len(set(scene.player_positions)), scene.block_count)
开发者ID:mimitantono,项目名称:pygame_exercises,代码行数:7,代码来源:tests.py

示例7: __init__

 def __init__(self, nextScene, text="press enter...", *a):
     Scene.__init__(self, *a)
     self.nextScene = nextScene
     font = data.filepath('You Are Loved.ttf')
     figure = leafs.TextoAlineado(text, font, size=1000, alignx=0.5, aligny=0.5)
     self.group.add(figure)
     self.accept()
开发者ID:italomaia,项目名称:turtle-linux,代码行数:7,代码来源:view.py

示例8: __init__

 def __init__(self, nrows, *args, **kwargs):
     Scene.__init__(self, *args, **kwargs)
     self.nrows            = nrows
     self.diagram_height   = 2*SPACE_HEIGHT - 1
     self.diagram_width    = 1.5*SPACE_WIDTH
     self.cell_height      = self.diagram_height / nrows
     self.cell_width       = self.diagram_width / nrows
     self.portion_to_fill  = 0.7
     self.bottom_left      = np.array(
         (-self.cell_width * nrows / 2.0, -self.cell_height * nrows / 2.0, 0)
     )
     num_to_num_mob   = {} 
     self.coords_to_mobs   = {}
     self.coords = [(n, k) for n in range(nrows) for k in range(n+1)]    
     for n, k in self.coords:
         num = choose(n, k)              
         center = self.coords_to_center(n, k)
         if num not in num_to_num_mob:
             num_to_num_mob[num] = TexMobject(str(num))
         num_mob = num_to_num_mob[num].copy()
         scale_factor = min(
             1,
             self.portion_to_fill * self.cell_height / num_mob.get_height(),
             self.portion_to_fill * self.cell_width / num_mob.get_width(),
         )
         num_mob.center().scale(scale_factor).shift(center)
         if n not in self.coords_to_mobs:
             self.coords_to_mobs[n] = {}
         self.coords_to_mobs[n][k] = num_mob
     self.add(*[self.coords_to_mobs[n][k] for n, k in self.coords])
开发者ID:astoeckley,项目名称:manim,代码行数:30,代码来源:combinatorics.py

示例9: parseconfig

def parseconfig(config):
    data = json.loads(config)
    objectlist, lights = [], []
    for conf in data["objects"]:
        if conf["type"] == "sphere":
            posx, posy, posz = conf["position"]
            r = conf["radius"]
            col = conf["color"]
            roughness = conf["roughness"]
            obj = objects.CollidableSphere(
                position=euclid.Point3(posx, posy, posz), radius=r, color=col, roughness=roughness
            )
        elif conf["type"] == "plane":
            orix, oriy, oriz = conf["origin"]
            normx, normy, normz = conf["normal"]
            roughness = conf["roughness"]
            obj = objects.CollidablePlane(
                origin=euclid.Point3(orix, oriy, oriz), normal=euclid.Vector3(normx, normy, normz), roughness=roughness
            )
        objectlist.append(obj)
    for conf in data["lights"]:
        x, y, z = conf
        lights.append(objects.Light(position=euclid.Point3(x, y, z)))
    conf = data["camera"]
    imgw, imgh = conf["imageDim"]
    scrw, scrh = conf["screenDim"]
    focal = conf["focallength"]
    camera = Camera(imageDim=(imgw, imgh), focallength=focal, screenDim=(scrw, scrh))
    scene = Scene(camera=camera, objects=objectlist, lights=lights)
    scene.skycolor = tuple(data["skycolor"])
    depth = data["depth"]

    return camera, depth, lights, objectlist, scene
开发者ID:Skyyrunner,项目名称:raycaster3,代码行数:33,代码来源:configuredraycaster.py

示例10: __init__

 def __init__(self):
     #Initialisation de la scene
     Scene.__init__(self)
     #Chargement de l'image de fond de la scene
     self.fond = fonction.charger_image("fond.jpg")
     #Chargement des objets
     self.bulles = bulles.Bulles() 
     self.pointeur = pointeur.Pointeur(15,24) 
     #self.pointeur.positionner(15,3) 
     self.poisson_1 = poisson.Poisson()
     self.poisson_2 = poisson.Poisson()
     self.poisson_3 = poisson.Poisson()
     self.poisson_4 = poisson.Poisson()
     
     #Chargement de la musique de fond 
     #self.musique = pygame.mixer.music.load("./sons/bouge.ogg")
     #self.musique.set_volume(0.5)
     #self.musique.fadeout(400) 
 
     #Chargement des textes à afficher
     self.texte_titre = fonction.Texte("Aquarium", 50, constante.noir)
     self.texte_stitre = fonction.Texte("Credits", 20, constante.gris)
     self.credis = credis.lire_credis()
     self.texte_credis = fonction.Texte_multiligne( (self.credis) )
     self.texte_credis.position(0, 0, 380, 65)
     self.texte_retour = fonction.Texte(" > Retour [R]",30, constante.bleufonce)
开发者ID:creasitenet,项目名称:python_pygame_aquarium,代码行数:26,代码来源:scenes.py

示例11: main

def main():
	import scene
	from scene import Scene
	game = Scene()
	grassBackground = Grass()
	game.sprites = [grassBackground]
	game.start()
开发者ID:townsean,项目名称:Buford,代码行数:7,代码来源:Grass.py

示例12: __init__

 def __init__(self, world, game):
     Scene.__init__(self, world)
     self.game = game
     self.step = 0
     self._create_sprites()
     self.text = text.History("Good bye robot city...")
     self.texts = []
     pyglet.clock.schedule_once(self._create_text, 3)
开发者ID:hugoruscitti,项目名称:irobotgame,代码行数:8,代码来源:post_game_scenes.py

示例13: test_render

 def test_render(self):
   renderer = LuxRenderer(samples_per_pixel=1000)
   scene = Scene()
   scene.camera = Camera(loc=(0, -10, 0), to=(0, 0, 0))
   scene.objects.append(Sphere())
   scene.objects.append(Sphere(center=(1, -1, 0.5), radius=0.5,
                               light=AreaLight(color=(1, 1, 1))))
   renderer.render(scene, generate_only=True)
开发者ID:eterevsky,项目名称:animations,代码行数:8,代码来源:test_lux.py

示例14: __init__

    def __init__(self, world):
        Scene.__init__(self, world)
        self.step = 0
        self._load_background()
        self.name = text.AboutText()
        self._create_sprites()

        pyglet.clock.schedule_once(self.show_losersjuegos_logo, 4 + 3 * 2)
开发者ID:hugoruscitti,项目名称:irobotgame,代码行数:8,代码来源:about.py

示例15: dither

 def dither(self, time = 1, blink = True):
     while time > 0:
         if blink and time%2 == 1:
             self.play(Blink(self.randy))
         else:
             Scene.dither(self, time)
         time -= 1
     return self
开发者ID:scottopell,项目名称:manim,代码行数:8,代码来源:characters.py


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