Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson8_diy3
This project
Loading...
Sign in
Toggle navigation
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
17edc4f6
authored
Jan 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
7fe7ad33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
my_game.py
my_game.py
View file @
17edc4f6
import
pygame
x
'x'
x
'x'
x
'xxxxxxx
import pygame
from pygame import locals
from pygame import locals
import random
import random
pygame.init() # 初始化
pygame.init() # 初始化
class Block(pygame,sprite,Sprite):
class Block(pygame,sprite,Sprite):
def_init_(self,imaga1,imaga2,imaga3):
def_init_(self,imaga1,imaga2,imaga3):
supere
()
.
_init_
()
supere()._init_()
s'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's
self.image = random.choice([image1,image2,image3])
self.image = random.choice([image1,image2,image3])
self.rect = self.imef.image.get_rect()
self.rect = self.imef.image.get_rect()
self.rect.x= 1000
self.rect.x= 1000
self
.
rect
.
y
=
500
-
self
.
rect
.
height
self.rect.y =500 - self.rect.height
ssssssssssssssssssssssss'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's
class Player(pygame,sprite,Sprite):
class Player(pygame,sprite,Sprite):
def_init_(self,image):
def_init_(self,image):
super
()
.
_init_
()
super()._init_()
ssss'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
ssss
's'
s
'ssssss'
s
's'
s
's'
s
's'
s
's'
s
'ssssss'
s
's'
s
's'
s
's'
ss
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
ssssssssssssssssssssssssssssssss
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
s
's'
ssssss
self
.
image
=
image
self
.
image
=
image
self
.
rect
=
self
.
imef
.
image
.
get_rect
()
self
.
rect
=
self
.
imef
.
image
.
get_rec
.
x
=
150
sssssssssssssssssssssss
self
.
rect
.
x
=
150
self
.
rect
.
y
=
400
def
(
self
,
parameter_list
):
def
(
self
,
parameter_list
):
raise
NotImplementedError
raise
NotImplementedError
...
@@ -92,7 +90,7 @@ while True:
...
@@ -92,7 +90,7 @@ while True:
# 创建障碍物对象
# 创建障碍物对象
time
+=
1
time
+=
1
if
time
>=
60
:
if
time
>=
60
:
r
=
randon
.
randint
(
0
,
100
)
r
=
randon
.
randint
(
0
,
100
)
x
'x'
x
'x'
x
'xxxxxxx
if r>40:
if r>40:
obstacle = Block(bush,cacti,stome)
obstacle = Block(bush,cacti,stome)
block_list.add(obstacle)
block_list.add(obstacle)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment