本文整理汇总了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]
示例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)
示例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 )
示例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)
示例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)
示例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)
示例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)
示例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)
示例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))
示例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()
示例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)
示例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 )
示例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)
示例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)
示例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