本文整理汇总了Python中Player.go方法的典型用法代码示例。如果您正苦于以下问题:Python Player.go方法的具体用法?Python Player.go怎么用?Python Player.go使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.go方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BackGround
# 需要导入模块: import Player [as 别名]
# 或者: from Player import go [as 别名]
BackGround("RSC/Background/Illuminati.png", True, [0,-1])
score = Score([width-300, height-25], "Score: ", 80)
spawnRate = .3 #seconds
player1 = Player((width/2, height/2), 1)
player2 = Player((width/2, height/2), 2)
while run == "game":
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
player1.go("up")
if event.key == pygame.K_UP:
player2.go("up")
if event.key == pygame.K_d:
player1.go("right")
if event.key == pygame.K_RIGHT:
player2.go("right")
if event.key == pygame.K_s:
player1.go("down")
if event.key == pygame.K_DOWN:
player2.go("down")
if event.key == pygame.K_a:
player1.go("left")
if event.key == pygame.K_LEFT:
player2.go("left")
if event.key == pygame.K_SPACE:
示例2: Player
# 需要导入模块: import Player [as 别名]
# 或者: from Player import go [as 别名]
zombieTimer = 0
zombieTimerMax = .75 * 60
zombieLimit = 5
bgImage = pygame.image.load("Backgrounds/Room1.png")
bgRect = bgImage.get_rect()
player = Player([width/2, height/2])
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
player.go("up")
elif event.key == pygame.K_DOWN:
player.go("down")
elif event.key == pygame.K_LEFT:
player.go("left")
elif event.key == pygame.K_RIGHT:
player.go("right")
elif event.key == pygame.K_a:
player.go("attack")
elif event.type == pygame.KEYUP:
if event.key == pygame.K_UP:
player.go("stop up")
elif event.key == pygame.K_DOWN:
player.go("stop down")
elif event.key == pygame.K_LEFT:
player.go("stop left")