[Python] How to place sprites onto rect object in pygame?

Discussão em 'Python' iniciado por Stack, Março 28, 2025.

  1. Stack

    Stack Membro Participativo

    I was wondering if any of you knew how to attach a sprite to a rect object I already made in pygame?

    Here's my code:

    blocktexture1 = pygame.sprite.Sprite()
    blocktexture1.rect = self.platforms
    for block in self.platforms:
    pygame.draw.rect(screen, self.colour, block, 0)


    I don't understand which rectangle to apply the sprite rect thing to!

    Continue reading...

Compartilhe esta Página