Commit 537c149c by BellCodeEditor

save project

parent 04644cb9
Showing with 8 additions and 9 deletions
class hero:
def__init__(self,name,hp,attack):
def __init__(self,name,hp,attack):
self.level = 1
self.name = name
self.hp = hp
self.attack = attack
def upgrade(self):
self.level = chenshi.level + 1
self.hp = chenshi.hp +50
self.attack + 4
def upgrade(self):
self.level = self.level + 1
self.hp = self.hp +50
self.attack = self.attack + 4
chenshi = hero("陈石"300,20)
chenshi = hero("陈石",300,20)
print(chenshi.name+"一级攻击力是"+str(chenshi.attack))
chenshiupgrade()
upgrade()
upgrde()
chenshi.upgrade()
print(chenshi.name+"现在的攻击力是"+str(chenshi.attack))
\ No newline at end of file
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