So my pygame window just won't stop flickering. I know if only one item is in snake.snakearray
, it won't flicker.
#class for the array
class snake:
snakearray = [[ScreenConfigs.width / 2,ScreenConfigs.height / 2],[ScreenConfigs.width / 2,ScreenConfigs.height / 2]]
direction = "up"
increment = 0.1
#loop to draw the snake
while Running:
for snakeBit in snake.snakearray:
pygame.draw.rect(display,"black",(0,0,ScreenConfigs.width,ScreenConfigs.height))
pygame.draw.rect(display,"white",(snakeBit[0],snakeBit[1],30,30))
pygame.display.flip()
I tried putting the pygame.display.flip()
outside of the loop and it only drew that last rectangle. (because when you call pygame.draw.rect
, it disregards the last one drew)