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
a51bc220
authored
Oct 05, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
47c27f8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
240 deletions
diy1.py
diy1.py
View file @
a51bc220
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
()
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
.
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()实现用户输入账号、密码的功能
# 如果用户输入的账号、密码正确,提示登陆成功
\ No newline at end of file
you
\ 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