Commit 955e0cd3 by BellCodeEditor

save project

parent 6ed40306
Showing with 7 additions and 8 deletions
class Hero: class Hero:
def __init__(self,name,hp,attact): def __init__(self,name,hp,attact):
self.HP=300 self.hp=300
self.level=1 self.level=1
self.attact=20 self.attact=20
self.color='red' self.color='red'
def upgrade(self): def upgrade(self):
self.level+=1 self.level+=1
self.hp+=50 self.hp+=50
self.attact+=4 self.attact+=4
def test_hero(self): def test_hero(self):
print('test_hero') print('test_hero')
yase=Hero('yase',300,50) yase=Hero('yase',300,50)
print(yase.HP) print(yase.hp)
print(yase.level)
print(yase.attact)
yase.test_hero() yase.test_hero()
upgrade() yase.upgrade()
print(yase.hp)
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