0

In my Pygame code for pong, I created a group for Sprites in order to detect collisions, but receive a recursion error whenever I try to add my objects to it.

I can make each object move, but when I make my Sprite group and attempt to add objects to it, it gives me a recursion error. I've compared my codes to other code, in addition to other pong code, and it seems to match up well.

The code that's giving me the recursion error:

import pygame


all_sprites_list = pygame.sprite.Group()
all_sprites_list.add(b1)
all_sprites_list.add(p1b)
all_sprites_list.add(p2b)

It should be able to add each object to the built in Sprite group, then detect collisions, but instead I get a recursion error. Why is this?

Martin Gergov
  • 1,556
  • 4
  • 20
  • 29
Danny
  • 1
  • Can you please show the full error message. In which line of your code do you get the error. Possibly the error occurs when you add this lines of code, but it is not the cause of the error. – Rabbid76 Nov 11 '19 at 21:00
  • In addition to what @Rabbid76, we need _way_ more of your code. Please read: [mcve]. – AMC Nov 11 '19 at 21:22

0 Answers0