Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson24-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
e2b0b450
authored
Aug 29, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
419facf0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
39 deletions
q.py
render.html
q.py
deleted
100644 → 0
View file @
419facf0
import
pygame
pygame
.
init
()
ball
=
pygame
.
image
.
load
(
'w.gif'
)
speed
=
[
1
,
1
]
size
=
width
,
height
=
600
,
400
screen
=
pygame
.
display
.
set_mode
(
size
,
pygame
.
RESIZABLE
)
pygame
.
display
.
set_caption
(
'pygame游戏之旅'
)
fclock
=
pygame
.
time
.
Clock
()
black
=
(
0
,
0
,
0
)
ballrect
=
ball
.
get_rect
()
fps
=
200
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
pygame
.
QUIT
:
exit
()
elif
event
.
type
==
pygame
.
KEYDOWN
:
if
event
.
key
==
pygame
.
K_LEFT
:
speed
[
0
]
=
speed
[
0
]
if
speed
[
0
]
==
0
else
(
abs
(
speed
[
0
])
-
1
)
if
event
.
key
==
pygame
.
K_RIGHT
:
speed
[
0
]
=
speed
[
0
]
+
1
if
speed
[
0
]
>
0
else
speed
[
0
]
-
1
if
event
.
key
==
pygame
.
K_UP
:
speed
[
1
]
=
speed
[
1
]
+
1
if
speed
[
1
]
>
0
else
speed
[
1
]
-
1
if
event
.
key
==
pygame
.
K_DOWN
:
speed
[
1
]
=
speed
[
1
]
if
speed
[
1
]
==
0
else
(
abs
(
speed
[
1
])
-
1
)
ballrect
=
ballrect
.
move
(
speed
[
0
],
speed
[
1
])
if
ballrect
.
left
<
0
or
ballrect
.
right
>
width
:
speed
[
0
]
=-
speed
[
0
]
if
ballrect
.
top
<
0
or
ballrect
.
bottom
>
height
:
speed
[
1
]
=-
speed
[
1
]
screen
.
fill
(
black
)
screen
.
blit
(
ball
,
ballrect
)
fclock
.
tick
(
fps
)
pygame
.
display
.
update
()
\ No newline at end of file
render.html
View file @
e2b0b450
...
...
@@ -7,11 +7,11 @@
</head>
<body>
<div
id=
"
802a3370fa4b4588b2c53750341d2a97
"
class=
"chart-container"
style=
"width:900px; height:500px;"
></div>
<div
id=
"
eded43a60fc7485aaff3468a66ef3900
"
class=
"chart-container"
style=
"width:900px; height:500px;"
></div>
<script>
var
chart_
802a3370fa4b4588b2c53750341d2a97
=
echarts
.
init
(
document
.
getElementById
(
'
802a3370fa4b4588b2c53750341d2a97
'
),
'white'
,
{
renderer
:
'canvas'
});
var
option_
802a3370fa4b4588b2c53750341d2a97
=
{
var
chart_
eded43a60fc7485aaff3468a66ef3900
=
echarts
.
init
(
document
.
getElementById
(
'
eded43a60fc7485aaff3468a66ef3900
'
),
'white'
,
{
renderer
:
'canvas'
});
var
option_
eded43a60fc7485aaff3468a66ef3900
=
{
"animation"
:
true
,
"animationThreshold"
:
2000
,
"animationDuration"
:
1000
,
...
...
@@ -357,7 +357,7 @@
"subtext"
:
"\u6210\u7ee9"
}
};
chart_
802a3370fa4b4588b2c53750341d2a97
.
setOption
(
option_802a3370fa4b4588b2c53750341d2a97
);
chart_
eded43a60fc7485aaff3468a66ef3900
.
setOption
(
option_eded43a60fc7485aaff3468a66ef3900
);
</script>
</body>
</html>
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