Commit 6ed40306 by BellCodeEditor

save project

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