本文整理汇总了Python中Player.render方法的典型用法代码示例。如果您正苦于以下问题:Python Player.render方法的具体用法?Python Player.render怎么用?Python Player.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: import Player [as 别名]
# 或者: from Player import render [as 别名]
movex = 10
elif event.key == pygame.K_SPACE:
player.jump()
if event.type == pygame.KEYUP:
if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT:
movex = 0
mainWindow.fill((0,100,255))
for block in blockList:
block.x -= movex
block.render(mainWindow)
if movex >= 0:
player.x += movex/4 - movex/5
else:
player.x += -movex/4 + movex/5
player.update(gravity, blockList)
player.render(mainWindow)
if (player.y >= 600):
gameLoop = False
print "You loser!"
fps.tick(60)
pygame.display.flip()
pygame.quit()
quit()
示例2: Player
# 需要导入模块: import Player [as 别名]
# 或者: from Player import render [as 别名]
clock = pygame.time.Clock()
player = Player(0, 0)
gameLoop = True
while gameLoop: #The main loop that does not break unless Esc is pressed
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameLoop = False
window.fill(skyBlue)
for block in blockList:
block.render(window)
player.update(gravity)
player.render(window)
clock.tick(60)
pygame.display.flip()
pygame.quit()
def load_image(name):
fullname = os.path.join('data', name)
try:
image = pygame.image.load(fullname)
except pygame.error, message:
print 'Cannot load image:', name
raise SystemExit, message
image = image.convert()
return image, image.get_rect()