I am attempting to draw a line between two different instances of the same sprite class, the sprite class being coded in as shown here (this is just the __init__
function):
class Atom(pygame.sprite.Sprite):
"""Creates an atom of an element.
The element can be specified using the element parameter.
This will take a dict argument, contained in a constants file of some sort."""
def __init__(self, element, centre_loc):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((30, 30), pygame.SRCALPHA)
pygame.gfxdraw.aacircle(self.image, 15, 15, 14, (0, 255, 0))
pygame.gfxdraw.filled_circle(self.image, 15, 15, 14, (0, 255, 0))
self.rect = self.image.get_rect()
self.rect.center = centre_loc
self.element = element
self.show_text(element)
self.print_properties(self.element)
I have tried to do this using the code here:
pygame.draw.line(screen, color, sprite.rect.right. sprite.rect.left)
I have simplified the above code, to highlight what I have actually done. The actual code for the above is found here, it is commented out on line 25. The rest of the code can also be found in that repository for reference.
I had hoped that this would work however I got this error instead:
TypeError: Invalid start point argument
So what am I doing wrong here? Thanks in advance.