Commit f498fc29 by BellCodeEditor

save project

parent 5cf58be8
Showing with 11 additions and 7 deletions
class Hero: class Hero:
def __init__(self,hp,attack): def __init__(self,level,hp,attack):
self.level = 1 self.level = 1
self.hp = 300 self.hp = 300
self.attack = 20 self.attack = 20
yase = Hero(300,20) def upd(self):
def upd(): self.level += 1
yase.hp += 50 self.hp += 50
yase.attack += 4 self.attack += 4
upd() yase = Hero(1,300,20)
upd()
for i in range(14):
yase.upd()
print('yase的等级为:',yase.level)
print('yase的血量值为:',yase.hp) print('yase的血量值为:',yase.hp)
print('yase的攻击值为:',yase.attack) print('yase的攻击值为:',yase.attack)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment