Commit 5ac49c3c by BellCodeEditor

save project

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