コード例 #1
0
 def handle_draw(self, entity):
     ratio = entity.time_remaining / entity.time_limit
     x, y = get_midpoint(entity)
     game.get_game().renderer.appendCircle((50, 50, 50), x, y,
                                           entity.width / 2)
     game.get_game().renderer.appendFan((200, 200, 200), x, y,
                                        entity.width / 2, ratio)
コード例 #2
0
    def handle_draw(self, entity):
#         print entity.x,entity.y
#         screen_x, screen_y = transform(entity.x, entity.y)
#         r = pygame.Rect(int(screen_x), int(screen_y), entity.height, entity.width)
#         pygame.draw.ellipse(surface, entity.color, r)
        if entity.visible:
            p = get_midpoint(entity)
            game.get_game().renderer.appendPlayerCircle( entity.color,p.x,p.y, entity.height/2) 
コード例 #3
0
    def handle_action(self, entity, action):
        if action == 'TRAP' and entity.trap_cooldown <= 0:
            p = get_midpoint(entity)
            game.get_game().renderer.appendRing(entity.color, int(p[0]),
                                                int(p[1]), entity.trap_out_rad,
                                                entity.trap_in_rad)

            #pygame.draw.circle(game.get_game().screen, entity.color, (int(p[0]), int(p[1])), entity.smoke_screen_rad)
            entity.trap_cooldown = entity.trap_cooldown_time
コード例 #4
0
    def handle_action(self, entity, action):
        if action == 'SMOKE_SCREEN' and entity.smoke_screen_cooldown <= 0:
            p = get_midpoint(entity)
            game.get_game().renderer.appendCircle(entity.color, int(p[0]),
                                                  int(p[1]),
                                                  entity.smoke_screen_rad)

            #pygame.draw.circle(game.get_game().screen, entity.color, (int(p[0]), int(p[1])), entity.smoke_screen_rad)
            entity.smoke_screen_cooldown = entity.smoke_screen_cooldown_time
コード例 #5
0
    def handle_action(self, entity, action):
        if action == 'TRAP' and entity.trap_cooldown <= 0:
            p = get_midpoint(entity)
            game.get_game().renderer.appendRing( 
                    entity.color,int(p[0]), int(p[1]), entity.trap_out_rad, entity.trap_in_rad
                    )

            #pygame.draw.circle(game.get_game().screen, entity.color, (int(p[0]), int(p[1])), entity.smoke_screen_rad)
            entity.trap_cooldown = entity.trap_cooldown_time
コード例 #6
0
    def handle_action(self, entity, action):
        if action == 'SMOKE_SCREEN' and entity.smoke_screen_cooldown <= 0:
            p = get_midpoint(entity)
            game.get_game().renderer.appendCircle( 
                    entity.color,int(p[0]), int(p[1]), entity.smoke_screen_rad
                    )

            #pygame.draw.circle(game.get_game().screen, entity.color, (int(p[0]), int(p[1])), entity.smoke_screen_rad)
            entity.smoke_screen_cooldown = entity.smoke_screen_cooldown_time
コード例 #7
0
 def handle_draw(self, entity):
     #         print entity.x,entity.y
     #         screen_x, screen_y = transform(entity.x, entity.y)
     #         r = pygame.Rect(int(screen_x), int(screen_y), entity.height, entity.width)
     #         pygame.draw.ellipse(surface, entity.color, r)
     if entity.visible:
         p = get_midpoint(entity)
         game.get_game().renderer.appendPlayerCircle(
             entity.color, p.x, p.y, entity.height / 2)
コード例 #8
0
ファイル: pivot.py プロジェクト: fabiangeisler/fg-tools
def move_pivot_to_components(components):
    """
    puts the Pivot to the current component selection

    :param list[str] components: A list of components.
    """
    vertices = com.convert_to_vertices(components)
    transform = vertices[0].split('.')[0]

    mid_x, mid_y, mid_z = com.get_midpoint(vertices)

    cmds.move(mid_x, mid_y, mid_z, transform + '.scalePivot')
    cmds.move(mid_x, mid_y, mid_z, transform + '.rotatePivot')
コード例 #9
0
ファイル: modeling.py プロジェクト: fabiangeisler/fg-tools
def move_components_to_axis(components, axis='x'):
    """
    puts selected Components to the average of the specified axis
    """
    vertices = com.convert_to_vertices(components)
    aver = com.get_midpoint(vertices)

    if axis == 'x':
        cmds.move(aver[0], components, x=True)
    elif axis == 'y':
        cmds.move(aver[1], components, y=True)
    else:
        cmds.move(aver[2], components, z=True)
コード例 #10
0
 def handle_action(self, entity, action):
     if action == 'PLACE_MINEFIELD' and entity.minefield_cooldown <= 0:
         m = get_midpoint(entity)
         for r in range(entity.minefield_min_rad, entity.minefield_max_rad, entity.minefield_rad_density):
             anglestart = 0
             angleend = 360
             for a in xrange(anglestart, angleend, entity.minefield_ang_density):
                 v = Vec2d(0, 1)
                 v.length = r
                 v.angle = a
                 p = m + v
                 #pygame.draw.circle(game.get_game().screen, entity.color, (int(p[0]), int(p[1])), 5)
                 game.get_game().renderer.appendPlayerCircle( entity.color,int(p[0]), int(p[1]), 5)
         entity.minefield_cooldown = entity.minefield_cooldown_time
コード例 #11
0
 def handle_action(self, entity, action):
     if action == 'PLACE_MINEFIELD' and entity.minefield_cooldown <= 0:
         m = get_midpoint(entity)
         for r in range(entity.minefield_min_rad, entity.minefield_max_rad,
                        entity.minefield_rad_density):
             anglestart = 0
             angleend = 360
             for a in xrange(anglestart, angleend,
                             entity.minefield_ang_density):
                 v = Vec2d(0, 1)
                 v.length = r
                 v.angle = a
                 p = m + v
                 #pygame.draw.circle(game.get_game().screen, entity.color, (int(p[0]), int(p[1])), 5)
                 game.get_game().renderer.appendPlayerCircle(
                     entity.color, int(p[0]), int(p[1]), 5)
         entity.minefield_cooldown = entity.minefield_cooldown_time
コード例 #12
0
 def handle_draw(self, entity):
     ratio = entity.time_remaining / entity.time_limit
     x, y = get_midpoint(entity)
     game.get_game().renderer.appendCircle((50,50,50), x, y, entity.width/2)
     game.get_game().renderer.appendFan((200,200,200), x, y, entity.width/2, ratio)