Commit 941b309a by BellCodeEditor

auto save

parent f0eb2b3c
Showing with 14 additions and 16 deletions
class Hero:
def __init__(self,name):
self.name = name
self.level = 1
self.attack = 40
self.max_hp = self.hp
import turtle
pen = turtle.Pen()
# 请创造师在下面接着创作
sc=turtle.Screen()
sc.bgcolor("black")
for i in range(300):
pen.forward(i)
colors=["red","orange","yellow","green"]
pen.pencolor(colors[i%4])
pen.right(91)
# 隐藏画笔,保存画布
pen.hideturtle()
turtle.done()
\ No newline at end of file
def combat(self,enemy):
info1 = self.name+"对"+enemy.name+"发动进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
enemy.hp -=self.attack
if enemy.hp > 0:
info3 = enemy.name+"还剩下"+str(enemy.hp)+"血量"
\ 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