本文整理汇总了Python中Player.moveDown方法的典型用法代码示例。如果您正苦于以下问题:Python Player.moveDown方法的具体用法?Python Player.moveDown怎么用?Python Player.moveDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.moveDown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mainMenu
# 需要导入模块: import Player [as 别名]
# 或者: from Player import moveDown [as 别名]
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
if event.type == KEYUP:
if event.key == K_ESCAPE:
pygame.quit()
sys.exit()
if event.key == K_LEFT or event.key == ord('a'):
player.moveLeft(False)
示例2: playerCollision
# 需要导入模块: import Player [as 别名]
# 或者: from Player import moveDown [as 别名]
#toggle map mode
draw_radius = not draw_radius
elif event.key == K_SPACE:
dungeon.generate(TILE_EMPTY,TILE_ROOM,TILE_HALL)
player.x = dungeon.entrance_x+1
player.y = dungeon.entrance_y+1
elif event.key==K_UP or event.key==K_w:
if player.moveUp() == False:
playerCollision(0,-1)
else:
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()