本文整理汇总了Python中Entity.Entity.velX方法的典型用法代码示例。如果您正苦于以下问题:Python Entity.velX方法的具体用法?Python Entity.velX怎么用?Python Entity.velX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity.Entity
的用法示例。
在下文中一共展示了Entity.velX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import velX [as 别名]
def main():
print "main"
pygame.init()
screen = display.set_mode(DISPLAY, FLAGS, DEPTH)
display.set_caption("Use arrows to move!")
timer = time.Clock()
dh = displayhandler.DisplayHandler()
#kh = keyhandler.KeyHandler()
mh = MapHandler()
player = Entity("sprites\OptimizedSprites\\nerdOp.png")
#MapHandler.load('map1.txt','map1b.txt')
print "before loop"
done = False
while not done:
timer.tick(60)
#print timer.get_fps(), "\n"
dh.update(screen, player, mh, kh)
done = kh.key_update()
kh.update_player(player, 5)
i = 0
if player.onGround:
#print "grounded!"
i = 1
else:
if player.velY < 8:
player.velY += 1
if not kh.check_world():
for tile in mh.map_b:
apply_physics(tile, player)
i +=1
else:
for tile in mh.map_a:
apply_physics(tile, player)
player.move_ip(player.velX, 0 )
player.velX = 0
if not kh.check_world():
for tile in mh.map_b:
apply_physics(tile, player)
i +=1
else:
for tile in mh.map_a:
apply_physics(tile, player)
player.move_ip(0, player.velY )
# print "looped " ,i , " times"
pygame.quit()