[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Some help, please...



When I ran your code all I got was a black screen. The reason you aren't seeing anything is the way you're using the draw.circle function. The position that you pass to it should be relative to the surface you're drawing on.

Put these two lines in the __init__ for SnakeHead, SnakeBody, and SnakeTail:

relativeCenter = self.rect.width / 2, self.rect.height / 2
PG.draw.circle(self.image,(255,0,0),relativeCenter, 4)


Also I noticed that you commented out the "import pygame" line in the test file. When you import something python will automatically check to see if the module has already been loaded, so there's no performance hit for importing it twice...