Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_3
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
76a37704
authored
Apr 18, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
b4e599c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
diy2.py
diy2.py
View file @
76a37704
...
@@ -18,13 +18,15 @@ class Hero():
...
@@ -18,13 +18,15 @@ class Hero():
yase
=
Hero
(
"垭瑟"
)
yase
=
Hero
(
"垭瑟"
)
houyi
=
Hero
(
"后羿"
)
houyi
=
Hero
(
"后羿"
)
class
Player
(
Hero
):
class
Player
(
Hero
):
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
,
type
):
super
()
.
__init__
(
name
)
super
()
.
__init__
(
name
)
self
.
hp
=
100
self
.
hp
=
100
self
.
attack
=
400
self
.
attack
=
400
player
=
Player
(
"后羿"
)
self
.
type
=
type
print
(
"欢迎来到王者农药"
)
print
(
"玩家的血量为:"
,
self
.
hp
)
print
(
"玩家的等级为:"
,
self
.
level
)
print
(
"玩家的攻击力为:"
,
self
.
attack
)
print
(
"玩家的名称为:"
,
self
.
name
)
player
=
Player
(
"后羿"
,
"射手"
)
computer
=
Hero
(
"亚瑟"
)
computer
=
Hero
(
"亚瑟"
)
print
(
"玩家的血量为:"
,
player
.
hp
)
print
(
"玩家的等级为:"
,
player
.
level
)
print
(
"玩家的攻击力为:"
,
player
.
attack
)
print
(
"玩家的名称为:"
,
player
.
name
)
\ 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