Commit aa1585c7 by BellCodeEditor

save project

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