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


Python Character.shoot_gun方法代码示例

本文整理汇总了Python中Character.Character.shoot_gun方法的典型用法代码示例。如果您正苦于以下问题:Python Character.shoot_gun方法的具体用法?Python Character.shoot_gun怎么用?Python Character.shoot_gun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Character.Character的用法示例。


在下文中一共展示了Character.shoot_gun方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fabs

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import shoot_gun [as 别名]
            # rotate head
            #torso_vector = (me.bodies[me.bodies_enum["HEAD"]].position - me.bodies[me.bodies_enum["TORSO"]].position)
            #torso_rotate_angle = torso_vector.angle
            #elif event.key == pygame.K_q:
            #    me.rotate(CHARACTER_ANGULAR_VELOCITY_LIMIT, "TORSO")
            #elif event.key == pygame.K_e:
            #    me.rotate(-CHARACTER_ANGULAR_VELOCITY_LIMIT, "TORSO")

        elif event.type == pygame.MOUSEMOTION:
            # update location of pointer
            pointer_body.position = pygame_util.get_mouse_pos(screen)
            # update angle of pointer
            pointer_body.angle = (pointer_body.position - me.gun.body.position).angle

        elif event.type == pygame.MOUSEBUTTONDOWN:
            me.shoot_gun(space)

    for c in [c for c in space.characters if c.cid != PLAYER_ID]:  # eliminate player
        #print c.cid, "running basic ai"
        c.basic_ai(space)

    # prune a bullet if the bullet is outside the screen or has stopped moving
    for b in space.bullets[:]:  # iterate over a copy of the list
        if fabs(b.body.position.x - SCREEN_SIZE) > SCREEN_SIZE or \
           fabs(b.body.position.y - SCREEN_SIZE) > SCREEN_SIZE:
            space.remove_bullet(b)

        #print b.body.velocity.length
        if b.body.velocity.length < BULLET_PRUNING_VELOCITY:
            space.remove_bullet(b)
开发者ID:desophos,项目名称:ragdoll,代码行数:32,代码来源:ragdoll.py


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