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


Python sprite.RenderUpdates类代码示例

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


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

示例1: start_song

  def start_song(self):
    self.toparr_group = RenderUpdates()
    self.fx_group = RenderUpdates()
    self.text_group = RenderUpdates()
    self.text_group.add([self.score, self.lifebar, self.judging_disp])
    self.text_group.add(self.holdtext)

    if mainconfig["showcombo"]: self.text_group.add(self.combos)

    if self.game.double:
      self.arrow_group = [OrderedRenderUpdates(),
                          OrderedRenderUpdates()]

      for i in range(2):
        self.steps[i].play()
        for d in self.game.dirs:
          if mainconfig["explodestyle"] > -1:
            self.toparrfx[i][d].add(self.fx_group)
          if not self.dark: self.toparr[i][d].add(self.toparr_group)
      self.sprite_groups = [self.toparr_group, self.arrow_group[0],
                            self.arrow_group[1], self.fx_group,
                            self.text_group]
    else:
      self.steps.play()
      self.arrow_group = OrderedRenderUpdates()
      for d in self.game.dirs:
        if mainconfig["explodestyle"] > -1: self.toparrfx[d].add(self.fx_group)
        if not self.dark: self.toparr[d].add(self.toparr_group)
      self.sprite_groups = [self.toparr_group, self.arrow_group,
                            self.fx_group, self.text_group]
开发者ID:EvilDrW,项目名称:pydance,代码行数:30,代码来源:player.py

示例2: removeObject

    def removeObject(self, sprite):

       for i in self._spritelist:
           if i[0] == sprite:
               self._spritelist.remove(i)
               break
       RenderUpdates.remove_internal(self, sprite)
开发者ID:FOSSRIT,项目名称:fortunehunter,代码行数:7,代码来源:Scene.py

示例3: clear

	def clear( self, drawToSurface ):
		if self.bgMangr.dirty:
			#there's no point in clearing things because we're
			#about to wipe the whole surface in update()
			return
		RenderUpdates.clear( self, drawToSurface, 
		                     self.bgMangr.GetBgSurface )
开发者ID:rgsoda,项目名称:pyracers,代码行数:7,代码来源:scroll_group.py

示例4: clear

 def clear(self):
     """
         Clear all of the sprites in the group to the background.
     """
     levels = self.levels.keys()
     levels.sort()
     for l in levels:
         level = self.levels[l]
         RenderUpdates.clear(level, self.screen, self.bg)
开发者ID:noQ,项目名称:MoonLanding,代码行数:9,代码来源:Graphics.py

示例5: clear_layer

 def clear_layer(self):
     """Not used at this time.
     """
     for sprite in self.sprites():
         if len(self.levels) > 1:
             levels = self.levels.keys()
             levels.sort()
             for l in levels[1:]:
                 level = self.levels[l]
                 RenderUpdates.clear(level, self.screen, self.bg)
开发者ID:noQ,项目名称:MoonLanding,代码行数:10,代码来源:Graphics.py

示例6: add_below

 def add_below(self, ref_sprite, sprite):
     """ Add the sprite to the group below ref_sprite.
     
     The sprite will be added below ref sprite so ref_sprite is
     on top of it.
     """
     RenderUpdates.add_internal(self, sprite)
     i = self._spritelist.index(ref_sprite)
     self._spritelist.insert(i+1, sprite)
     
     sprite.add_internal(self)
开发者ID:Fenixin,项目名称:yogom,代码行数:11,代码来源:sprites.py

示例7: add_ontop

 def add_ontop(self, ref_sprite, sprite):
     """ Add the sprite to the group on top ref_sprite.
     
     The sprite will be added on top of ref sprite so ref_sprite is
     below of it.
     """
     RenderUpdates.add_internal(self, sprite)
     i = self._spritelist.index(ref_sprite)
     self._spritelist.insert(i, sprite)
     
     sprite.add_internal(self)
开发者ID:Fenixin,项目名称:yogom,代码行数:11,代码来源:sprites.py

示例8: __init__

    def __init__(self, items):
        platforms = [Platform([400 + 260 * i, 390], s[0], i)
                     for i, s in enumerate(items)]
        credits = Credits()
        self._score = TopScores()
        sprites = RenderUpdates([credits, self._score])
        sprites.add(platforms)

        pos = 0
        em = EventManager()
        em.clear()
        screen = pygame.display.get_surface()

        em.get()
        quit = False

        screen.blit(Menu.bg, [0, 0])
        sprites.draw(screen)
        pygame.display.update()
        
        while not quit:
            for ev in em.get():
                if ev.type == PLAYER:
                    if ev.key == LEFT:
                        if pos != 0:
                            pos -= 1
                            for p in platforms: p.left()
                    elif ev.key == RIGHT:
                        if pos != len(items) - 1:
                            pos += 1
                            for p in platforms: p.right()
                    else:
                        try:
                            r = items[pos][1][ev.key](self, platforms[pos],
                                                      pos, ev.key)
                            if r:
                                # If the callback returns true, then we
                                # need to redraw the whole screen and
                                # reread our scores. (If it returns false,
                                # it probably means it just modified some
                                # cart text).
                                self._score.read_scores()
                                screen.blit(Menu.bg, [0, 0])
                                pygame.display.update()
                        except KeyError: pass

                elif ev.type == QUIT: quit = True

            sprites.update(pygame.time.get_ticks())
            pygame.display.update(sprites.draw(screen))
            sprites.clear(screen, Menu.bg)
            pygame.time.clock.tick(60)
开发者ID:joshuacronemeyer,项目名称:Angry-Drunken-Programmers,代码行数:52,代码来源:menu.py

示例9: main

def main():
    fundo, tela, clock = config()
    musica = pygame.mixer.Sound("BGM/Firelink Shrine.wav")
    grupo = RenderUpdates()
    personagem = Hero(20, 290, "dante", grupo)
    pygame.font.init()
    frase = Text(40, 'Quem eh voce e oque faz aqui?', 'carolingia.ttf')

    lx = [b for b in range(-4, 76)]
    l1 = [-10]
    l2 = [6]

    parede = [x for x in range(-10, 16)]

    iniciarConversa = [43, 0]

    teclas = {K_LEFT: False, K_RIGHT: False, K_UP: False, K_DOWN: False,
              K_RETURN: False, 27: False}  # obs 27 = tecla 'esc'

    musica.play()
    fundo = fundo.convert()
    pygame.display.flip()
    while True:
        clock.tick(FPS)

        for e in pygame.event.get([KEYUP, KEYDOWN]):
            valor = (e.type == KEYDOWN)
            if e.key in teclas.keys():
                teclas[e.key] = valor

        if teclas[27]:  # tecla ESC
            pygame.quit()
            sys.exit()

        if teclas[K_LEFT]:
            personagem.move("LEFT")
        if teclas[K_RIGHT]:
            personagem.move("RIGHT")
        if teclas[K_UP]:
            personagem.move("UP")
        if teclas[K_DOWN]:
            personagem.move("DOWN")

        if personagem.px == iniciarConversa[0] and personagem.py == iniciarConversa[1]:
            tela.blit(frase.frases, (200, 500))
            pygame.display.flip()

        #print(personagem.px, personagem.py)

        grupo.clear(tela, fundo)
        pygame.display.update(grupo.draw(tela))
开发者ID:IuryAlves,项目名称:RPG-Pygame,代码行数:51,代码来源:rpg.py

示例10: __init__

    def __init__(self, sprites):

       self._spritelist = [[sprites, sprites.getXPos(), sprites.getYPos()]]
       #self._spritelist.append([sprites, sprites.getXPos(), sprites.getYPos()])
       RenderUpdates.__init__(self, sprites)

       self.xPos = 0
       self.yPos = 0
       self.xSize = 0
       self.ySize = 0
       
       self.calcPosition()
       self.calcSize()
       self.setRelativePositions()
开发者ID:FOSSRIT,项目名称:fortunehunter,代码行数:14,代码来源:Scene.py

示例11: __init__

    def __init__(self, layer=None, sprites=[]):
        """Initialize the sprite group.

        @param layer: L{Screen.Layer} in which the sprite lives.
        @param sprites: Initial sprite or sequence of sprites in the group.

        """
        self.levels = {0: self}
        if layer is None:
            layer = conf.window
        else:
            pass
        self.layer = layer
        self.screen = layer.screen
        self.bg = layer.bg
        RenderUpdates.__init__(self, sprites)
开发者ID:noQ,项目名称:MoonLanding,代码行数:16,代码来源:Graphics.py

示例12: __init__

	def __init__( self, screen, display ):
		self.screen = screen
		self.screenRect = screen.get_rect()
		self.display = display
		self.model = None
		self.currentTime = 0

		self.bgImage = load_png( 'bg_game.png' )

		self.hiGroup = RenderUpdates()
		self.lowGroup = RenderUpdates()
		self.viewOnlyGroup = RenderUpdates()
		self.bubbleGroup = RenderUpdates()

		self.ins_spin = None
		self.ins_press = None
		self.quitButton = None
		self.squeezePrompt = None

		self.groups = [self.lowGroup, self.bubbleGroup, self.hiGroup, self.viewOnlyGroup]
		self.locks = []

		self.stripeOrder = ['violet','blue','green',
		                    'yellow','orange','red']
		self.stripeHeights = {
		                     'violet': 233,
		                     'blue':   189, 
		                     'green':  136,
		                     'yellow': 85,
		                     'orange': 44,
		                     'red':    11,
		                    }
		self.heaterRects = { 
		                    'green':  Rect ( 160, 470, 80, 100 ),
		                    'blue':   Rect ( 265, 470, 80, 100 ),
		                    'violet': Rect ( 370, 470, 80, 100 ),
		                    'red':    Rect ( 475, 470, 80, 100 ),
		                    'orange': Rect ( 580, 470, 80, 100 ),
		                    'yellow': Rect ( 685, 470, 80, 100 ),
		}


		self.purseStatusbars = []

		controller = mvcState.GetController()
		controller.gameEventListeners.append( self )
开发者ID:sjbrown,项目名称:steam_jet_blower,代码行数:46,代码来源:model.py

示例13: add

    def add(self, sprites, level=0):
        """Add sprite to group.

            - sprites: a single sprite, or multiple sprites.
            - level: drawing layer at which to add the sprite.
                     higher numbers will be drawn on top of lower numbers.
                     level less than 0 indicate that sprits will be drawn bellow others
                     Default level is ZERO 
        """
        if level == 0:
            RenderUpdates.add(self, sprites)
        else:
            if not self.levels.has_key(level):
                level_group = SpriteGroup(self.layer)
                self.levels[level] = level_group
            else:
                level_group = self.levels[level]
            level_group.add(sprites)
开发者ID:noQ,项目名称:MoonLanding,代码行数:18,代码来源:Graphics.py

示例14: add_internal

    def add_internal (self, sprite):
        """RenderLayer.add_internal (...) -> None
        """
        if sprite in self.spritedict:
            return
        RenderUpdates.add_internal (self, sprite)

        if sprite.depth == 0:
            self.sprite_depths.insert (0, sprite)
        else:
            success = False
            for i in range (len (self.sprite_depths) - 1):
                candidate = self.sprite_depths[i]
                if sprite.depth < candidate.depth:
                    self.sprite_depths.insert (i, sprite)
                    success = True
                    break
            if not success:
                self.sprite_depths.append (sprite)
开发者ID:UncommonAvenue,项目名称:mm-x-ctf,代码行数:19,代码来源:RenderLayer.py

示例15: draw

 def draw(self):
     """
         draw all sprites onto the surface
     """
     render = []
     levels = self.levels.keys()
     levels.sort()
     for lvl in levels:
         level = self.levels[lvl]
         render += RenderUpdates.draw(level, self.screen)
     return render
开发者ID:noQ,项目名称:MoonLanding,代码行数:11,代码来源:Graphics.py


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