本文整理汇总了Python中World.World.render方法的典型用法代码示例。如果您正苦于以下问题:Python World.render方法的具体用法?Python World.render怎么用?Python World.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World.World
的用法示例。
在下文中一共展示了World.render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: World
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import render [as 别名]
done = False
world = World()
debug = True
#################
### Game loop ###
#################
while not done:
# Read cotrols
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
world.hero.startJump()
elif event.type == pygame.KEYUP:
if event.key == pygame.K_w:
world.hero.endJump()
# Update
world.update(pygame.key.get_pressed())
#Render
world.render(screen)
pygame.display.flip()
clock.tick(60)
# Be IDLE friendly
pygame.quit()
示例2: main
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import render [as 别名]
#.........这里部分代码省略.........
main_world.sound_classes[0].play()
if option == 1:
"""start"""
current_state = "game"
pygame.mixer.music.stop()
main_world.game_over = False
try:
main_world.set_up_level(main_world.levels[main_world.level_index])
except IndexError:
main_world.level_index = 0
main_world.set_up_level(main_world.levels[main_world.level_index])
elif option == 2:
"""level select"""
current_state = "level select"
elif option == 3:
"""help"""
current_state = "help"
elif option == 4:
"""links"""
current_state = "links"
elif option == 5:
"""credits"""
current_state = "credits"
elif option == 6:
"""quit"""
done = True
main_menu.render(screen)
screen.blit(menu_cursor_image, (mouse_pos[0]-16, mouse_pos[1]-16))
pygame.display.flip()
elif current_state == "help":
main_menu.help_screen(screen,mouse_pos)
pressed_keys = pygame.key.get_pressed()
if pressed_keys[pygame.K_ESCAPE]:
current_state = "menu"
pygame.display.flip()
elif current_state == "links":
if main_menu.links(screen,mouse_pos,time_passed_seconds) == "link":
current_state = "menu"
pressed_keys = pygame.key.get_pressed()
if pressed_keys[pygame.K_ESCAPE]:
current_state = "menu"
pygame.display.flip()
elif current_state == "level select":
selected_level = main_menu.level_select(screen, mouse_pos, time_passed_seconds, main_world)
if selected_level is not None:
current_state = "game"
main_world.game_over = False
pygame.mixer.music.stop()
main_world.set_up_level(selected_level)
main_world.level_index = main_world.levels.index(selected_level)
pressed_keys = pygame.key.get_pressed()
if pressed_keys[pygame.K_ESCAPE]:
current_state = "menu"
pygame.display.flip()