Exemplo n.º 1
0
 def _draw_debug_levelmap(self, surface, debug_params):
     """
     show the level map directly, usefull to debug
     """
     if debug_params["levelmap"]:
         draw_rect(surface,
                   pygame.Rect(self.place[0] / 8, self.place[1] / 8, 2, 2),
                   pygame.Color('red'))
Exemplo n.º 2
0
 def draw_minimap(self, surface):
     ''' draw minimap in the upper/right corner of the screen, showing blocs
     '''
     for rect in self.map:
         draw_rect(
             surface,
             pygame.Rect(rect[0] / 8, rect[1] / 8, rect[2] / 8,
                         rect[3] / 8), pygame.Color('grey'))
Exemplo n.º 3
0
 def _draw_debug_levelmap(self, surface, debug_params):
     """
     show the level map directly, useful to debugging
     """
     if debug_params["levelmap"]:
         draw_rect(
                 surface,
                 pygame.Rect(self.place[0] / 8, self.place[1] / 8, 2, 2),
                 pygame.Color('red'))
Exemplo n.º 4
0
 def draw_minimap(self, surface):
     ''' draw minimap in the upper/right corner of the screen, showing blocs
     '''
     for rect in self.map:
         draw_rect(
                 surface,
                 pygame.Rect(
                     rect[0] / 8,
                     rect[1] / 8,
                     rect[2] / 8,
                     rect[3] / 8),
                 pygame.Color('grey'))
Exemplo n.º 5
0
 def _draw_debug_footrect(self, coords, zoom, surface, debug_params):
     """
     if footrect debug is set, draw the footrect collision rect to the screen
     """
     if self.visible:
         if debug_params.get('footrect', False):
             r = self.foot_rect
             draw_rect(
                 surface,
                 pygame.Rect(coords[0] + (r[0] - self.rect[0]) * zoom,
                             coords[1] + (r[1] - self.rect[1]) * zoom,
                             r[2] * zoom, r[3] * zoom),
                 pygame.Color(255, 255, 0, 127))
Exemplo n.º 6
0
    def draw_debug_map(self, surface, level_place, zoom):
        ''' draw the map before the level, to show the real level shape
        '''
        draw_rect(
            surface,
            pygame.Rect(level_place[0] + self.border[0] * zoom,
                        level_place[1] + self.border[1] * zoom,
                        self.border[2] * zoom, self.border[3] * zoom),
            pygame.Color('white'))

        draw_rect(
            surface,
            pygame.Rect(level_place[0], level_place[1], self.rect[2] * zoom,
                        self.rect[3] * zoom), pygame.Color('lightblue'))

        for rect in self.map:
            draw_rect(
                surface,
                pygame.Rect(int(level_place[0] + (rect[0]) * zoom),
                            int(level_place[1] + (rect[1]) * zoom),
                            int(rect[2] * zoom), int(rect[3] * zoom)),
                pygame.Color('green'))

        for rect in self.entrypoints:
            draw_rect(
                surface,
                pygame.Rect(int(level_place[0] + (rect[0]) * zoom),
                            int(level_place[1] + (rect[1]) * zoom), 20, 20),
                pygame.Color('blue'))
Exemplo n.º 7
0
 def _draw_debug_footrect(self, coords, zoom, surface, debug_params):
     """
     if footrect debug is set, draw the footrect collision rect to the screen
     """
     if self.visible:
         if debug_params.get('footrect', False):
             r = self.foot_rect
             draw_rect(
                     surface,
                     pygame.Rect(
                         coords[0] + (r[0] - self.rect[0]) * zoom,
                         coords[1] + (r[1] - self.rect[1]) * zoom,
                         r[2] * zoom,
                         r[3] * zoom),
                     pygame.Color(255, 255, 0, 127))
Exemplo n.º 8
0
    def _draw_debug_hardshape(self, coords, zoom, surface, debug_params):
        """
        if hardshape debug is set, draw the hardshape of the player on the screen
        """
        if self.visible:
            if debug_params.get('hardshape', False):
                draw_rect(
                    surface,
                    pygame.Rect(coords[0] + self.hardshape[0] * zoom,
                                coords[1] + self.hardshape[1] * zoom,
                                self.hardshape[2] * zoom,
                                self.hardshape[3] * zoom),
                    pygame.Color(255, 0, 0, 127))

                for n, i in enumerate(self.update_points()):
                    draw_rect(
                        surface,
                        pygame.Rect(
                            (coords[0] + (i[0] - self.rect[0]) * zoom,
                             coords[1] + (i[1] - self.rect[1]) * zoom, 2, 2)),
                        n > 3 and pygame.Color('green')
                        or pygame.Color('blue'))
Exemplo n.º 9
0
    def _draw_debug_hardshape(self, coords, zoom, surface, debug_params):
        """
        if hardshape debug is set, draw the hardshape of the player on the screen
        """
        if self.visible:
            if debug_params.get('hardshape', False):
                draw_rect(
                        surface,
                        pygame.Rect(
                            coords[0] + self.hardshape[0] * zoom,
                            coords[1] + self.hardshape[1] * zoom,
                            self.hardshape[2] * zoom,
                            self.hardshape[3] * zoom),
                        pygame.Color(255, 0, 0, 127))

                for n, i in enumerate(self.update_points()):
                    draw_rect(
                            surface,
                            pygame.Rect((
                                coords[0] + (i[0] - self.rect[0]) * zoom,
                                coords[1] + (i[1] - self.rect[1]) * zoom,
                                2, 2)),
                            n > 3 and pygame.Color('green') or
                            pygame.Color('blue'))
Exemplo n.º 10
0
    def draw_debug_map(self, surface, level_place, zoom):
        ''' draw the map before the level, to show the real level shape
        '''
        draw_rect(
                surface,
                pygame.Rect(
                level_place[0] + self.border[0] * zoom,
                level_place[1] + self.border[1] * zoom,
                self.border[2] * zoom,
                self.border[3] * zoom),
                pygame.Color('white'))

        draw_rect(
                surface,
                pygame.Rect(
                level_place[0],
                level_place[1],
                self.rect[2] * zoom,
                self.rect[3] * zoom),
                pygame.Color('lightblue'))

        for rect in self.map:
            draw_rect(
                    surface,
                    pygame.Rect(
                        int(level_place[0] + (rect[0]) * zoom),
                        int(level_place[1] + (rect[1]) * zoom),
                        int(rect[2] * zoom),
                        int(rect[3] * zoom)),
                    pygame.Color('green'))

        for rect in self.entrypoints:
            draw_rect(
                    surface,
                    pygame.Rect(
                        int(level_place[0] + (rect[0]) * zoom),
                        int(level_place[1] + (rect[1]) * zoom),
                        20, 20),
                    pygame.Color('blue'))