Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_4
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
b8764725
authored
Apr 19, 2025
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
ce0a9cdb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
diy2.py
diy2.py
View file @
b8764725
class
Hero
:
import
turtle
as
t
def
__init__
(
self
,
name
,
hp
,
attack
):
import
random
as
r
self
.
level
=
1
t
.
setup
(
1000
,
800
)
self
.
name
=
name
t
.
screensize
(
800
,
600
,
'skyblue'
)
self
.
hp
=
hp
def
draw_circle
(
radius
,
color
,
y_position
):
self
.
attack
=
attack
t
.
penup
()
def
upgrade
(
self
):
t
.
pensize
(
3
)
self
.
hp
=
self
.
hp
+
50
t
.
fillcolor
(
color
)
self
.
level
=
self
.
level
+
1
t
.
goto
(
0
,
y_position
)
self
.
attack
=
self
.
attack
+
4
t
.
pendown
()
yase
=
Hero
(
"yase"
,
300
,
20
)
t
.
begin_fill
()
houyi
=
Hero
(
"houyi"
,
300
,
20
)
t
.
circle
(
radius
)
yase
.
upgrade
()
t
.
end_fill
()
print
(
yase
.
hp
)
def
draw_bullet
():
\ No newline at end of file
t
.
penup
()
t
.
goto
(
r
.
randint
(
-
200
,
200
),
r
.
randint
(
-
200
,
200
))
t
.
pendown
()
t
.
dot
(
20
)
draw_circle
(
200
,
'yellow'
,
-
200
)
draw_circle
(
150
,
'red'
,
-
150
)
draw_circle
(
100
,
'blue'
,
-
100
)
draw_circle
(
50
,
'skyblue'
,
-
50
)
for
i
in
range
(
5
):
draw_bullet
()
t
.
done
()
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