Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def scroe_text_screen(text, color, x, y):
with open("high score.txt","w") as f:
f.write(str(hiscore))
game_windrow.fill(black)
scroe_text_screen("Your Score: "+str(score), red, (WIDTH/2)-110, 150)
scroe_text_screen(f"Your Score: {str(score)}", red, (WIDTH/2)-110, 150)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function game_loop refactored with the following changes:

scroe_text_screen("Game Is Over! Press Enter To continue", red, 150, 250)
for event in pygame.event.get():
if event.type == pygame.QUIT:
Expand Down Expand Up @@ -99,7 +99,7 @@ def scroe_text_screen(text, color, x, y):
if score > int(hiscore):
hiscore = score

scroe_text_screen('Scroe: ' + str(score)+" "+ " High Score "+str(hiscore), red, 5, 5)
scroe_text_screen(f'Scroe: {str(score)} High Score {str(hiscore)}', red, 5, 5)
pygame.draw.rect(game_windrow, black, [snake_x, snake_y, snake_size, snake_size])
head = []
head.append(snake_x)
Expand Down