Comments on: Pygame Rect Tutorial – Creating Rects https://coderslegacy.com/python/pygame-rect-tutorial/ Imparting knowledge to the Future Fri, 02 Jun 2023 14:27:52 +0000 hourly 1 By: Navjot Singh https://coderslegacy.com/python/pygame-rect-tutorial/#comment-1897 Fri, 02 Jun 2023 14:27:52 +0000 https://coderslegacy.com/?page_id=5100#comment-1897 In reply to Mago.

I guess you are talking about a visible rectangle around the image you loaded. Setting a color key can make that invisible and only image will be displayed. please refer the sample code below.

class player(pygame.sprite.Sprite):
    def __init__(self, filename):
        super().__init__()
       
        self.image = pygame.image.load(filename).convert_alpha()
        self.image.set_colorkey((255, 255, 255))
       
        self.rect = self.image.get_rect()

]]>
By: galorky https://coderslegacy.com/python/pygame-rect-tutorial/#comment-1590 Sat, 04 Mar 2023 19:08:55 +0000 https://coderslegacy.com/?page_id=5100#comment-1590 In reply to Mago.

dont blit it?

]]>
By: Siddiqi https://coderslegacy.com/python/pygame-rect-tutorial/#comment-1382 Tue, 30 Aug 2022 09:17:07 +0000 https://coderslegacy.com/?page_id=5100#comment-1382 In reply to Mago.

Rects are actually invisible. The color comes from the Surface objects which they are a part of. In short, if you create directly using the Rect class, then it will be invisible.

]]>
By: Mago https://coderslegacy.com/python/pygame-rect-tutorial/#comment-1378 Sat, 27 Aug 2022 05:32:09 +0000 https://coderslegacy.com/?page_id=5100#comment-1378 how do i make it invisible

]]>
By: Vol https://coderslegacy.com/python/pygame-rect-tutorial/#comment-1367 Tue, 16 Aug 2022 03:00:53 +0000 https://coderslegacy.com/?page_id=5100#comment-1367 In reply to Oclelot 44.

hii

]]>
By: Oclelot 44 https://coderslegacy.com/python/pygame-rect-tutorial/#comment-1077 Sat, 08 Jan 2022 02:34:50 +0000 https://coderslegacy.com/?page_id=5100#comment-1077 hi

]]>