Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson7_diy2
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
1b60f656
authored
Jan 08, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
bf58f598
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
my_game.py
sss.py
my_game.py
View file @
1b60f656
...
@@ -20,6 +20,7 @@ obstacle=random.choice([bush,stone,cacti])
...
@@ -20,6 +20,7 @@ obstacle=random.choice([bush,stone,cacti])
rect
=
obstacle
.
get_rect
()
rect
=
obstacle
.
get_rect
()
rect
.
x
=
1000
rect
.
x
=
1000
rect
.
y
=
500
-
rect
.
height
rect
.
y
=
500
-
rect
.
height
'''
while True:
while True:
for event in pygame.event.get():
for event in pygame.event.get():
if event.type == locals.QUIT:
if event.type == locals.QUIT:
...
@@ -63,4 +64,21 @@ while True:
...
@@ -63,4 +64,21 @@ while True:
rect.x-=8
rect.x-=8
screen.blit(obstacle,(rect.x,rect.y))
screen.blit(obstacle,(rect.x,rect.y))
pygame.display.update()
pygame.display.update()
FPS
.
tick
(
30
)
FPS.tick(30)
\ No newline at end of file
'''
t
=
30
y
=
400
while
True
:
if
j
==
"up"
:
if
t
>
0
:
y
-=
t
t
-=
2
else
:
j
=
"down"
print
(
y
)
if
j
==
"down"
:
if
t
<=
30
:
y
+=
t
t
+=
2
else
:
j
=
"runing"
\ No newline at end of file
sss.py
0 → 100644
View file @
1b60f656
t
=
30
y
=
400
while
True
:
if
jumpState
==
"up"
:
if
t
>
0
:
y
-=
t
t
-=
2
else
:
jumpState
=
"down"
print
(
y
)
if
jumpState
==
"down"
:
if
t
<=
30
:
y
+=
t
t
+=
2
else
:
jumpState
=
"runing"
\ No newline at end of file
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