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 4ef47146 authored a year ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent 022ec8df
Hide whitespace changes
Inline Side-by-side
Showing with 55 additions and 7 deletions
  • fsfssf/ggg.py
  • fsfssf/jjj.py
  • fsfssf/ppp.py
  • my_game.py
fsfssf/ggg.py 0 → 100644
View file @ 4ef47146
def a1(num):
if num==1:
return 1
temp=a1(num-1)
return num+temp
a1_num = a1(100)
print(a1_num)
\ No newline at end of file
This diff is collapsed. Click to expand it.
fsfssf/jjj.py 0 → 100644
View file @ 4ef47146
def peach(n):
if n==10:
return 1
num = (peach(n+1)+1)*2
return num
peach_num = peach(1)
print(peach_num)
\ No newline at end of file
This diff is collapsed. Click to expand it.
fsfssf/ppp.py 0 → 100644
View file @ 4ef47146
def q1(n):
if n<=2:
return 1
elif n>2:
value = q1(n-1)+q1(n-2)
return value
result = q1(8)
print(result)
\ No newline at end of file
This diff is collapsed. Click to expand it.
my_game.py
View file @ 4ef47146
......@@ -11,19 +11,42 @@ road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头
cacti = pygame.image.load('cacti.png') # 仙人掌
apple = pygame.image.load('bush.png') # 灌木丛
hero = pygame.image.load('hero1.png')
index = 0
hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero2.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
i = 0
js="runing"
y=400
js="runing"
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type == locals.KEYDOWN:
if event.key==locals.K_SPACE:
js="up"
if js=="up":
if y>150:
y-=5
else:
js="down"
if js=="down":
if y<400:
y+=5
else:
js="runing"
wkong=hero[i]
i=i+1
if i==5:
i=0
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(hero, (150, 400))
screen.blit(wkong, (150, y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(0)
\ 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