0

def snake(headX, headY, oldX, oldY, has_change):
    pygame.draw.rect(screen, GREEN, (headX, headY, width, height))
    if has_change: 
        if len(snakebody) == 0:
            newblock = Block(oldX , oldY)
        else:
            lastblock = snakebody[len(snakebody) -1]
            newblock = Block(lastblock.x + 30, lastblock.y )
        snakebody.append(newblock)
    
   

What I am trying to do is make the body follow the head directly behind. My code is making it so that the body is to the corner of the head. I am also using Pygame so there's that.

0 Answers0