Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_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
251646e6
authored
Feb 21, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
9a5b4e42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
diy2.py
diy2.py
View file @
251646e6
from
time
import
*
class
Hero
:
def
__init__
(
self
,
name
,
xueliang
,
gongjili
):
self
.
level
=
100
...
...
@@ -5,17 +6,23 @@ class Hero:
self
.
xueliang
=
xueliang
self
.
gongjili
=
gongjili
zhangweijia
=
Hero
(
"张洧嘉"
,
1000
,
10000
)
# mama = Hero("李平","无限","无限"
)
qiaozhi
=
Hero
(
"乔治"
,
1
,
1
)
print
(
zhangweijia
.
name
)
print
(
"血量:"
,
zhangweijia
.
xueliang
)
print
(
"攻击力:"
,
zhangweijia
.
gongjili
)
# print(mama.name)
# print("血量:",mama.xueliang)
# print("攻击力:",mama.gongjili)
def
shengji
():
zhangweijia
.
xueliang
=
zhangweijia
.
xueliang
+
500
zhangweijia
.
gongjili
=
zhangweijia
.
gongjili
+
5000
shengji
()
print
(
zhangweijia
.
name
)
print
(
"血量:"
,
zhangweijia
.
xueliang
)
print
(
"攻击力:"
,
zhangweijia
.
gongjili
)
\ No newline at end of file
zhangweijia
.
level
+=
1
def
qiaozhishengji
():
qiaozhi
.
xueliang
=
qiaozhi
.
xueliang
+
-
500
qiaozhi
.
gongjili
=
qiaozhi
.
gongjili
+
-
5000
qiaozhi
.
level
+=
1
while
True
:
sleep
(
1
)
shengji
()
print
(
"等级:"
,
zhangweijia
.
level
)
print
(
"血量:"
,
zhangweijia
.
xueliang
)
print
(
"攻击力:"
,
zhangweijia
.
gongjili
)
qiaozhishengji
()
print
(
"等级:"
,
qiaozhi
.
level
)
print
(
"血量:"
,
qiaozhi
.
xueliang
)
print
(
"攻击力:"
,
qiaozhi
.
gongjili
)
\ 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