I have snake that is turning and drawing trajectory behind him but I don't know how to make holes like random pauses while he's drawing. I tried it and it's not random but problem is that it's very fast pause. It's like teleporting move. Here is my code:
import pygame
pygame.init()
import random
from random import randint
win = pygame.display.set_mode((1280,720))
background = pygame.Surface(win.get_size(), pygame.SRCALPHA)
background.fill((0, 0, 0, 1))
x = randint(150,1130)
y = randint(150,570)
vel = 0.6
drawing_time = 0
direction = pygame.math.Vector2(vel, 0).rotate(random.randint(0, 360))
run = True
while run:
pygame.time.delay(5)
drawing_time += 1
if drawing_time == 1000:
for pause in range(0, 60):
head = pygame.draw.circle(win, (255,0,0), (round(x), round(y)), 0)
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
direction.rotate_ip(-0.8)
if keys[pygame.K_RIGHT]:
direction.rotate_ip(0.8)
x += direction.x
y += direction.y
time = 0
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
direction.rotate_ip(-0.8)
if keys[pygame.K_RIGHT]:
direction.rotate_ip(0.8)
x += direction.x
y += direction.y
win.blit(background, (12020,0))
head= pygame.draw.circle(win, (255,0,0), (round(x), round(y)), 5)
pygame.display.update()
pygame.quit()
I tried to give that head radius 0 and maybe that is problem but I don't have any idea how to solve it.