本文整理汇总了Python中Player.moveLeft方法的典型用法代码示例。如果您正苦于以下问题:Python Player.moveLeft方法的具体用法?Python Player.moveLeft怎么用?Python Player.moveLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.moveLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mainMenu
# 需要导入模块: import Player [as 别名]
# 或者: from Player import moveLeft [as 别名]
if musicPlaying:
pygame.mixer.music.stop()
else:
pygame.mixer.music.play(-1, 0.0)
musicPlaying = not musicPlaying
mainMenu()
# run the game loop
while playGame == 1:
for event in pygame.event.get():
checkQuit(event)
if event.type == KEYDOWN:
# change the keyboard variables
if event.key == K_LEFT or event.key == ord('a'):
player.moveLeft(True)
if event.key == K_RIGHT or event.key == ord('d'):
player.moveRight(True)
if event.key == K_UP or event.key == ord('w'):
player.moveUp(True)
if event.key == K_DOWN or event.key == ord('s'):
player.moveDown(True)
if event.key == ord('f'):
addLaser()
if event.key == ord('p'):
pauseMenu()
if event.key == K_SPACE:
if player.isShield:
player.isShield = False
else:
player.isShield = True
示例2: move_monsters
# 需要导入模块: import Player [as 别名]
# 或者: from Player import moveLeft [as 别名]
move_monsters()
elif event.key==K_DOWN or event.key==K_s:
if player.moveDown() == False:
playerCollision(0,1)
else:
move_monsters()
elif event.key==K_RIGHT or event.key==K_d:
if player.moveRight() == False:
playerCollision(1,0)
else:
move_monsters()
elif event.key==K_LEFT or event.key==K_a:
if player.moveLeft() == False:
playerCollision(-1,0)
else:
move_monsters()
#clear the background
backbuffer.fill((20,20,20))
#draw the dungeon
if draw_radius:
dungeon.draw_radius(backbuffer, player.x, player.y, 6)
else:
dungeon.draw(backbuffer)
#draw the player's little dude