本文整理汇总了Python中Player.dy方法的典型用法代码示例。如果您正苦于以下问题:Python Player.dy方法的具体用法?Python Player.dy怎么用?Python Player.dy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.dy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: levspeftext
# 需要导入模块: import Player [as 别名]
# 或者: from Player import dy [as 别名]
levelTime = font.render(str((time - time%10) / 1000.0), 1, (255, 0, 0))
screen.blit(levelTime, (80, 58))
levspeftext()
for w in walls:
w.draw()
if w.rect.colliderect(snb.bottom) and (w.floor_active == False or w.floor_active == True)\
or ((w.rect.colliderect(snb.left) and w.rect.colliderect(snb.bottom)) and (w.wall_active == False or w.wall_active == True))\
or ((w.rect.colliderect(snb.right) and w.rect.colliderect(snb.bottom)) and (w.wall_active == False or w.wall_active == True)):
if pressed['Space'] == False:
snb.canJump = True
snb.dy = 0
snb.jumped = False
snb.jumptimer = 0
snb.apex = False
snb.onplat = True
w.floor_active = True
snb.wallJump_Left = False
snb.wallJump_Right = False
elif not(w.rect.colliderect(snb.bottom)) and w.floor_active == True:
w.floor_active = False
if w.rect.colliderect(snb.top):
snb.dy = 0
snb.apex = True
if w.rect.colliderect(snb.left) and (w.wall_active == False or w.wall_active == True):
示例2: mainGameInitialization
# 需要导入模块: import Player [as 别名]
# 或者: from Player import dy [as 别名]
CURRENT_GAME_STATE = "QUIT"
###Main Game###
#Initializing the game objects :
mainGameInitialization()
#The main game loop :
while CURRENT_GAME_STATE == "GAME":
#Loop on all the event sent by pygame :
for evt in pygame.event.get():
if evt.type == KEYDOWN:
if evt.key == K_DOWN:
player.dy = 2
elif evt.key == K_UP:
player.dy = -2
elif evt.key == K_LEFT:
player.dx = -2
elif evt.key == K_RIGHT:
player.dx = 2
elif evt.key == K_SPACE:
player.fireShot()
elif evt.key == K_LCTRL:
if player.activateShield == 0:
player.activateShield = 500
elif evt.key == K_F1:
player.currentWeapon = "fire1"
elif evt.key == K_F2:
player.currentWeapon = "fire2"