Created
November 10, 2017 17:00
-
-
Save bluemyria/0de1b240637b1769ce3a9ed8670371af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Game Loss | |
def game_loss(self): | |
self.board.create_text(PLAYGROUND_WIDTH/2,PLAYGROUND_HEIGHT/2,text="Game Over"\ | |
,font=('arial 30 bold'),fill='red') | |
self.gamevalid=0 | |
return | |
# Creating Snake Body Moving Function | |
def update_snake_body_structure(self): | |
x1,y1,x2,y2=self.board.coords(self.snake) | |
x2=(x2-((x2-x1)/2)) | |
y2=(y2-((y2-y1)/2)) | |
self.roadmap.append((x2,y2)) | |
self.board.delete('body') | |
if len(self.roadmap)>=self.bodylength: | |
self.roadmap=self.roadmap[-self.bodylength:] | |
self.board.create_line(tuple(self.roadmap), tag="body",width=10,fill=SNAKE_BODY_COLOR) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment