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

save project

parent aef61162
Show whitespace changes
Inline Side-by-side
Showing with 16 additions and 0 deletions
  • my_game.py
my_game.py
View file @ 7832ed81
import pygame
import random
from pygame import locals
pygame.init() # 初始化
......@@ -21,6 +22,12 @@ hero = [pygame.image.load('hero1.png'),
m = 0
j="runing"
y=400
w=random.choice([stone,cacti,apple])
rect=w.get_rect()
rect.x=1000
rect.y=500-rect.height
t=30
while True:
......@@ -57,5 +64,13 @@ while True:
screen.blit(road, (0, 500))
screen.blit(hero1, (150, y))
# 刷新画面
if rect.x<=0-rect.width:
w=random.choice([stone,cacti,apple])
rect=w.get_rect()
rect.x=1000
rect.y=500-rect.height
rect.x-=5
screen.blit(w,(rect.x,rect.y))
pygame.display.update()
FPS.tick(60)
\ 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