• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python sprite.RenderUpdates类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __init__

    def __init__(self):
        self.objs = {}
        self.events = []
        self.render = RenderUpdates()
        self.projectiles = Group()
        self.enemies = Group()
        self.you = None
        self.bg_sprite = BGSprite(pygame.display.get_surface())

        # Since we don't care about MOST EVENTS
        pygame.event.set_allowed(None)
        pygame.event.set_allowed([ MOUSEBUTTONDOWN, KEYDOWN, QUIT, UPDATEEVENT, SPAWNEVENT ])
开发者ID:alecain,项目名称:one,代码行数:12,代码来源:event.py


示例17: __init__

    def __init__( self, tela, descricao_mapa=None ):
        self.tela     = tela
        self.entrada  = None
        self.saida    = None
        self.tamanho  = None
        self.mapa     = None
        self.tam_peca = None

        # grupo que contem objetos nao desenhados
        self.nao_desenhados = RenderUpdates()

        if descricao_mapa:
            self.monta_labirinto( descricao_mapa )
开发者ID:wilsonfreitas,项目名称:pyga,代码行数:13,代码来源:lab.py


示例18: __init__

 def __init__(self, title='Checkers', log_drag=False, show_fps=False, ip='127.0.0.1', port=5000, spectate=False):
     self.game_running = True
     self.player = None
     self.log_drag = log_drag
     self.show_fps = show_fps
     self.window_title = title
     self.game = NetBoard(handler=self, ip=ip, port=port, spectate=spectate)
     # Initialize Game Groups
     self.board_spaces = set()
     self.pieces = RenderUpdates()
     self.piece_selected = GroupSingle()
     self.bg_text = RenderUpdates()
     self.fg_text = RenderUpdates()
     self.current_piece_position = ORIGIN
     self.screen = None
     self.fps_clock = None
     self.font = None
     self.background = None
     self.background_rect = None
     self.fps_text = None
     self.winner_text = None
     self.turn_text = None
     self.player_text = None
     self.game_id_text = None
开发者ID:batkinson,项目名称:checkers,代码行数:24,代码来源:checkers.py


示例19: __init__

    def __init__(self,level=0):
        pygame.init()
        
        self.screen = pygame.display.set_mode(self.screen_size)
        if self.title:
            pygame.display.set_caption(self.title)
        self.fps = 30

        #group definitions
        self.userPlacedObjects = Group()
        self.startItems = RenderUpdates()
        self.playerGroup = RenderUpdates()
        self.tails = RenderUpdates()
        self.blackHoles = RenderUpdates()
        self.obstacles = RenderUpdates()
        self.masslessObstacles = RenderUpdates()
        self.goalCollide = Group()
        self.toolbar = OrderedUpdates()

        #level/transition/player & enemy/obstacle creation hocus pocus
        self.goal = Goal(573,372,self.goalCollide,30)
        self.bar = ToolBar(0,626,self.toolbar,self.screen,self,self.goal)
        self.player = Player(50,535,self.screen,(255,0,0),self.playerGroup,1000,624,(2,-2),self.tails,self)
        
        self.level = level
        self.levelUp = True
        self.stars = Starfield(self.screen,1000,626,200)
        BlackHole(339,70,self.blackHoles,self.screen,80,71,16)
        temp = EarthRounder(513,313,self.masslessObstacles,self.screen,40,0)
        temp.rotate(55)
        temp = Alien(60,188,self.masslessObstacles,self.screen,34,1)
        temp.rotate(-15)
        temp = Alien(107,268,self.masslessObstacles,self.screen,35,1)
        temp.rotate(-75)
        temp = Alien(816,533,self.masslessObstacles,self.screen,39,0)
        temp.rotate(-13)
        temp = BlueUpAnDown(811,227,self.masslessObstacles,self.screen,34,1,97,239)
        temp.rotate(80)
        self.obstacles.add(self.blackHoles)
        self.obstacles.add(self.goalCollide)
        self.freeb = False
        self.gotoLevel = level
        self.loaded = False

        if system.thereIsASaveFile() and level == 0:
            self.intro_screen = Intro(0,0,self.startItems,str('title_w_file.png'))
            self.thereIsAFile = True
        elif level == 0:
            self.intro_screen = Intro(0,0,self.startItems)
            self.thereIsAFile = False
开发者ID:bitpit,项目名称:Gravity,代码行数:50,代码来源:main.py


示例20: __init__

 def __init__(self, title='Checkers', log_level=log.INFO, show_fps=False):
     log.basicConfig(level=log_level)
     self.show_fps = show_fps
     self.window_title = title
     self.game = Board(BOARD_DIM)
     # Initialize Game Groups
     self.brown_spaces = RenderUpdates()
     self.pieces = RenderUpdates()
     self.piece_selected = GroupSingle()
     self.space_selected = GroupSingle()
     self.current_piece_position = ORIGIN
     self.screen = None
     self.fps_clock = None
     self.font = None
     self.font_rect = None
     self.background = None
     self.background_rect = None
     self.fps_text = None
     self.fps_rect = None
     self.winner_text = None
     self.winner_rect = None
开发者ID:idrisr,项目名称:checkers,代码行数:21,代码来源:checkers.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sprite.Sprite类代码示例发布时间:2022-05-25
下一篇:
Python sprite.Group类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap