Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / pygame_lesson8_diy4

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit c7eacc63 authored 2 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent be29c8b3
Hide whitespace changes
Inline Side-by-side
Showing with 7 additions and 0 deletions
  • my_game.py
my_game.py
View file @ c7eacc63
......@@ -11,6 +11,7 @@ class Block(pygame.sprite.Sprite):
self.rect = self.image.get_rect()
self.rect.x = 1000
self.rect.y = 500 - self.rect.height
self.score = 1
class Player(pygame.sprite.Sprite):
def __init__(self,image):
......@@ -43,6 +44,7 @@ road_x = 0
background_x = 0
time = 0
gamestate = True
score = 0
block_list = pygame.sprite.Group()
......@@ -107,6 +109,11 @@ while True:
gameover = pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
gamestate = False
else:
if sprite.rect.x + sprite.rect.width < wukong.rect.x:
score += sprite.score
sprite.score = 0
print(score)
# 刷新画面
pygame.display.update()
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment