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

Administrator / pygame_lesson7_diy1

  • 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 f1de9412 authored 3 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent 80b7e96d
Show whitespace changes
Inline Side-by-side
Showing with 11 additions and 8 deletions
  • my_game.py
my_game.py
View file @ f1de9412
......@@ -23,7 +23,7 @@ y = 400
t=30
s=random.choice([stone,cacti,apple])
rect = s.get_rect()
rect.x=500
rect.x=1000
rect.y=500-rect.height
while True:
for event in pygame.event.get():
......@@ -31,7 +31,8 @@ while True:
# 接收到退出事件后退出程序
exit()
if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE and a=="running":
if a=="running":
if event.key==locals.K_SPACE:
a="up"
if a=="up":
if t>0:
......@@ -46,13 +47,13 @@ while True:
else:
a="running"
t=30
# if rect.x<0-rect.width:
# s=random.choice([stone,cacti,apple])
# rect = s.get_rect()
# rect.x=1000
# rect.y=500-rect.height
if rect.x<0-rect.width:
s=random.choice([stone,cacti,apple])
rect = s.get_rect()
rect.x=1000
rect.y=500-rect.height
rect.x-=10
screen.blit(s, (rect.x, rect.y))
wukong = hero[x]
if a=="running":
x+=1
......@@ -62,6 +63,7 @@ while True:
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
screen.blit(s, (rect.x, rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(25)
\ No newline at end of file
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