Commented the code in a better way
This commit is contained in:
parent
00c6b98355
commit
169773c92d
1 changed files with 12 additions and 1 deletions
13
tests.py
13
tests.py
|
@ -29,6 +29,7 @@ class Obstacle: # define all obstacles
|
||||||
self.position = position
|
self.position = position
|
||||||
self.width = width
|
self.width = width
|
||||||
|
|
||||||
|
highscore = 0
|
||||||
|
|
||||||
# define all obstacles
|
# define all obstacles
|
||||||
|
|
||||||
|
@ -95,6 +96,12 @@ while program_Running:
|
||||||
win.blit(ground, (groundCount, posGround)) # Displays the ground WILL NEED TO BE ADJUSTED WITH THE SPRITE AND TO BE LOOPED
|
win.blit(ground, (groundCount, posGround)) # Displays the ground WILL NEED TO BE ADJUSTED WITH THE SPRITE AND TO BE LOOPED
|
||||||
win.blit(walkSprite[(walkCount % 18)//3], (posPlayer, posy)) # Displays the caracter WILL NEED TO BE ADJUSTED WITH THE SPRITE
|
win.blit(walkSprite[(walkCount % 18)//3], (posPlayer, posy)) # Displays the caracter WILL NEED TO BE ADJUSTED WITH THE SPRITE
|
||||||
|
|
||||||
|
scoreText = smallFont.render(str(walkCount), False, (255, 0, 0))
|
||||||
|
win.blit(scoreText, (430, 0))
|
||||||
|
|
||||||
|
highScoreText = smallFont.render(str(highscore), False, (255, 0, 0))
|
||||||
|
win.blit(highScoreText, (30, 0))
|
||||||
|
|
||||||
for i in range(0, 6): # Checks across every Obstacle
|
for i in range(0, 6): # Checks across every Obstacle
|
||||||
if obstacles[i].position < 500: # if it is in the FOV
|
if obstacles[i].position < 500: # if it is in the FOV
|
||||||
|
|
||||||
|
@ -135,7 +142,11 @@ while program_Running:
|
||||||
if groundCount <= -641:
|
if groundCount <= -641:
|
||||||
groundCount = 0
|
groundCount = 0
|
||||||
|
|
||||||
# THe two texts when you lose
|
if walkCount > highscore:
|
||||||
|
highscore = walkCount
|
||||||
|
|
||||||
|
|
||||||
|
# The two texts when you lose
|
||||||
lostText = bigFont.render('YOU LOST', False, (255, 0, 0))
|
lostText = bigFont.render('YOU LOST', False, (255, 0, 0))
|
||||||
lostText2 = smallFont.render("Press Spacebar to replay", False, (255, 0, 0))
|
lostText2 = smallFont.render("Press Spacebar to replay", False, (255, 0, 0))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue