Commit 5ac49c3c by BellCodeEditor

save project

parent f2665cb5
Showing with 11 additions and 18 deletions
class Hero: import turtle
def __init__(self, name, hp, attack):
self.level = 1
self.name = name
self.hp = hp
self.attack = attack
def upgrade(): poen=turtle.pen()
self.level = self.level+1 colors=["red","orange","yellow","green"]
self.hp = self.hp+50 pen.speed(0)
self.attack = self.attack+4 for i in range(1,300):
pen.forward(i)
houyi = Hero("后一",240,23) pen.pencolor(colors[i%4])
houyi.upgrade() pen.right(91)
upgrade() pen.hideturtle()
print("血量: ",houyi.hp) turtle.done()
print("血量: ",houyi.level) \ No newline at end of file
print("血量: ",houyi.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