Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson4_1
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
47c27f8c
authored
Oct 04, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
792e4b08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
203 additions
and
0 deletions
diy1.py
diy1.py
View file @
47c27f8c
import
pygame
from
pygame
import
locals
import
pygame
from
pygame
import
locals
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
FPSCLOCK
=
pygame
.
time
.
Clock
()
aa
=
pygame
.
image
.
load
(
"bg.png"
)
bb
=
pygame
.
image
.
load
(
"right.png"
)
cc
=
pygame
.
image
.
load
(
"apple.png"
)
dd
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
x
,
y
=
240
,
120
position
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
exit
()
x
+=
30
position
.
append
((
x
,
y
))
position
.
pop
(
0
)
screen
.
blit
(
aa
,(
0
,
0
))
screen
.
blit
(
bb
,
position
[
-
1
])
for
i
in
range
(
len
(
position
)
-
1
):
screen
.
blit
(
dd
,
position
[
i
])
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
# 初始化pygame,为使用硬件做准备import pygame
from
pygame
import
locals
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
...
...
@@ -27,6 +59,177 @@ while True:
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
pygame
.
init
()
import
pygame
from
pygame
import
locals
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
FPSCLOCK
=
pygame
.
time
.
Clock
()
aa
=
pygame
.
image
.
load
(
"bg.png"
)
bb
=
pygame
.
image
.
load
(
"right.png"
)
cc
=
pygame
.
image
.
load
(
"apple.png"
)
dd
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
x
,
y
=
240
,
120
position
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
exit
()
x
+=
30
position
.
append
((
x
,
y
))
position
.
pop
(
0
)
screen
.
blit
(
aa
,(
0
,
0
))
screen
.
blit
(
bb
,
position
[
-
1
])
for
i
in
range
(
len
(
position
)
-
1
):
screen
.
blit
(
dd
,
position
[
i
])
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
FPSCLOCK
=
pygame
.
time
.
Clock
()
import
pygame
from
pygame
import
locals
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
FPSCLOCK
=
pygame
.
time
.
Clock
()
aa
=
pygame
.
image
.
load
(
"bg.png"
)
bb
=
pygame
.
image
.
load
(
"right.png"
)
cc
=
pygame
.
image
.
load
(
"apple.png"
)
dd
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
x
,
y
=
240
,
120
position
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
exit
()
x
+=
30
position
.
append
((
x
,
y
))
position
.
pop
(
0
)
screen
.
blit
(
aa
,(
0
,
0
))
screen
.
blit
(
bb
,
position
[
-
1
])
for
i
in
range
(
len
(
position
)
-
1
):
screen
.
blit
(
dd
,
position
[
i
])
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
aa
=
pygame
.
image
.
load
(
"bg.png"
)
import
pygame
from
pygame
import
locals
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
FPSCLOCK
=
pygame
.
time
.
Clock
()
aa
=
pygame
.
image
.
load
(
"bg.png"
)
bb
=
pygame
.
image
.
load
(
"right.png"
)
cc
=
pygame
.
image
.
load
(
"apple.png"
)
dd
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
x
,
y
=
240
,
120
position
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
exit
()
x
+=
30
position
.
append
((
x
,
y
))
position
.
pop
(
0
)
screen
.
blit
(
aa
,(
0
,
0
))
screen
.
blit
(
bb
,
position
[
-
1
])
for
i
in
range
(
len
(
position
)
-
1
):
screen
.
blit
(
dd
,
position
[
i
])
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
bb
=
pygame
.
image
.
load
(
"right.png"
)
import
pygame
from
pygame
import
locals
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
FPSCLOCK
=
pygame
.
time
.
Clock
()
aa
=
pygame
.
image
.
load
(
"bg.png"
)
bb
=
pygame
.
image
.
load
(
"right.png"
)
cc
=
pygame
.
image
.
load
(
"apple.png"
)
dd
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
x
,
y
=
240
,
120
position
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
exit
()
x
+=
30
position
.
append
((
x
,
y
))
position
.
pop
(
0
)
screen
.
blit
(
aa
,(
0
,
0
))
screen
.
blit
(
bb
,
position
[
-
1
])
for
i
in
range
(
len
(
position
)
-
1
):
screen
.
blit
(
dd
,
position
[
i
])
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
cc
=
pygame
.
image
.
load
(
"apple.png"
)
import
pygame
from
pygame
import
locals
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
FPSCLOCK
=
pygame
.
time
.
Clock
()
aa
=
pygame
.
image
.
load
(
"bg.png"
)
bb
=
pygame
.
image
.
load
(
"right.png"
)
cc
=
pygame
.
image
.
load
(
"apple.png"
)
dd
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
x
,
y
=
240
,
120
position
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
exit
()
x
+=
30
position
.
append
((
x
,
y
))
position
.
pop
(
0
)
screen
.
blit
(
aa
,(
0
,
0
))
screen
.
blit
(
bb
,
position
[
-
1
])
for
i
in
range
(
len
(
position
)
-
1
):
screen
.
blit
(
dd
,
position
[
i
])
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
dd
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
x
,
y
=
240
,
120
position
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
exit
()
x
+=
30
position
.
append
((
x
,
y
))
position
.
pop
(
0
)
screen
.
blit
(
aa
,(
0
,
0
))
screen
.
blit
(
bb
,
position
[
-
1
])
for
i
in
range
(
len
(
position
)
-
1
):
screen
.
blit
(
dd
,
position
[
i
])
screen
.
blit
(
cc
,(
360
,
300
))
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
# 保存在服务器数据库中的用户密码(正确的密码)
# 请用input()实现用户输入账号、密码的功能
...
...
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