Skip to content

Commit

Permalink
removed extra files
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol-Sharma21 committed Mar 30, 2024
1 parent 4c01ff0 commit fd7c9df
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 62 deletions.
2 changes: 1 addition & 1 deletion Projects/snake_game/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.idea
venv/
venv/q
8 changes: 0 additions & 8 deletions Projects/snake_game/.idea/.gitignore

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions Projects/snake_game/.idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions Projects/snake_game/.idea/modules.xml

This file was deleted.

10 changes: 0 additions & 10 deletions Projects/snake_game/.idea/snake_game.iml

This file was deleted.

6 changes: 0 additions & 6 deletions Projects/snake_game/.idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion Projects/snake_game/data.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15
0
2 changes: 1 addition & 1 deletion Projects/snake_game/food.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def __init__(self):
def refresh(self):
random_x = random.randint(-280, 280)
random_y = random.randint(-280, 280)
self.goto(random_x, random_y)
self.goto(random_x, random_y)
3 changes: 0 additions & 3 deletions Projects/snake_game/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,4 @@
scoreboard.reset()
snake.reset()




screen.exitonclick()
16 changes: 10 additions & 6 deletions Projects/snake_game/scoreboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ def __init__(self):
self.color("white")
self.penup()
self.goto(0, 270)
self.write(f"Score : {self.score} High Score : {self.high_score}", align=ALIGNMENT, font=FONT)
self.write(
f"Score : {self.score} High Score : {self.high_score}",
align=ALIGNMENT,
font=FONT,
)
self.hideturtle()

def update_scorebaord(self):
self.clear()
self.write(f"Score : {self.score} High Score : {self.high_score}", align=ALIGNMENT, font=FONT)
self.write(
f"Score : {self.score} High Score : {self.high_score}",
align=ALIGNMENT,
font=FONT,
)

def reset(self):
if self.score > self.high_score:
Expand All @@ -28,10 +36,6 @@ def reset(self):
self.score = 0
self.update_scorebaord()

# def game_over(self):
# self.goto(0,0)
# self.write(f"GAME OVER", align=ALIGNMENT, font=FONT)

def inc_score(self):
self.score += 1
self.clear()
Expand Down
5 changes: 0 additions & 5 deletions Projects/snake_game/snake.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
LEFT = 180
RIGHT = 0


class Snake:

def __init__(self):
Expand All @@ -19,15 +18,13 @@ def create_snake(self):
for position in STARTING_POSITION:
self.add_seg(position)


def add_seg(self, position):
seg_new = Turtle("square")
seg_new.color("white")
seg_new.penup()
seg_new.goto(position)
self.segments.append(seg_new)


def reset(self):
for seg in self.segments:
seg.goto(1000, 1000)
Expand All @@ -38,8 +35,6 @@ def reset(self):
def extend(self):
self.add_seg(self.segments[-1].position())



def move(self):
for seg_num in range(len(self.segments) - 1, 0, -1):
new_x = self.segments[seg_num - 1].xcor()
Expand Down

0 comments on commit fd7c9df

Please sign in to comment.