Commit aa1585c7 by BellCodeEditor

save project

parent ef43630b
Showing with 19 additions and 7 deletions
class Hero: class Hero:
def __init__(self): def __init__(self,name,hp,attact):
self.level=50 self.level=1
self.hp=1000 self.name=name
self.attact=100 self.hp=hp
yase=Hero() self.attact=attact
def upgrade(self,yase,houyi):
self.level = yase.level + 1
self.hp += 10
self.attact += 2
yase=Hero("yase",1,300,20)
houyi=Hero("houyi",1,250,25)
print("houyi hp =",houyi.hp)
print("yase hp =",yase.hp) print("yase hp =",yase.hp)
print("yase attact =",yase.attact) print("houyi level =",houyi.level)
\ No newline at end of file print("yase level =",yase.level)
print("yase attact =",yase.attact)
print("houyi attact =",houyi.attact)
\ 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