diff --git a/src/Snake.py b/src/Snake.py index ef0850a..ce58baf 100644 --- a/src/Snake.py +++ b/src/Snake.py @@ -32,7 +32,7 @@ def __init__(self, swiftness): self.dir, self.neck_asset = None, None # a list containing parts to add to the snake, allows better animation. - self.trail = [] + self.trail = None # the swiftness of the snake, inversely proportional to the rate at which the snake moves. # the number of life steps that the snake experienced. @@ -79,6 +79,9 @@ def spawn(self, y, x, h, w, init_length=3): # the assets are simply the head plus the right amount of body parts. self.assets = ['@'] + ['|' if self.dir in [curses.KEY_UP, curses.KEY_DOWN] else '-'] * len(tmp) + # reset the trail of the snake. + self.trail = [] + # reset the number of life steps. self.life_step = 0