当前位置: 首页>>代码示例>>Python>>正文


Python Player.dy方法代码示例

本文整理汇总了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):
开发者ID:nchen24,项目名称:superninjaboy,代码行数:33,代码来源:game.py

示例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"
开发者ID:Yoshii974,项目名称:SpaceShooterProject,代码行数:33,代码来源:spaceshooter.py


注:本文中的Player.dy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。