day 20 - fixed collision issues
This commit is contained in:
@ -50,10 +50,13 @@ class Snake:
|
||||
|
||||
def get_head_position(self):
|
||||
return self.segments[0].xcor(), self.segments[0].ycor()
|
||||
|
||||
def get_head(self):
|
||||
return self.segments[0]
|
||||
|
||||
def tailbite(self):
|
||||
for i in range(len(self.segments) - 1, 0, -1):
|
||||
if self.segments[0].position() == self.segments[i].position():
|
||||
if self.segments[0].distance(self.segments[i]) <= 15:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user