Commit fcecdb32 by BellCodeEditor

auto save

parent a8ba6dea
Showing with 257 additions and 0 deletions
class Hero:
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 250
self.attack = 40
self.max_hp = self.hp
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)+"血量"
info = info1+info2+info3
print(info)
else:
info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3
print(info)
exit()
class Player(Hero):
def __init__(self,name,hero_type):
super(Player, self).__init__(name)
self.hp = 200
self.attack = 50
self.hero_type = hero_type
# 角色xx创建成功,当前等级xx,血量xx,攻击力xx
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
houyi = Player( "后羿", "射手")
yase = Hero("垭瑟")
\ No newline at end of file
import turtle
import turtle
t=turtle.Turtle()
t.speed(0)
t.pensize(8)
#t.hideturtle()
# 猫脸外圈蓝色
t.fillcolor('#00A1E8')
t.begin_fill()
t.circle(120)
t.end_fill()
t.pensize(3)
t.fillcolor('white')
t.begin_fill()
t.circle(100)
t.end_fill()
t.penup()
#t.home()
t.goto(0, 134)
t.pendown()
t.pensize(4)
t.fillcolor("#EA0014")
t.begin_fill()
t.circle(18)
t.end_fill()
# t.penup()
# t.goto(7, 155)
# t.pensize(2)
# t.color('white', 'white')
# t.pendown()
# t.begin_fill()
# t.circle(4)
# t.end_fill()
# # 左眼
# t.penup()
# t.goto(-30, 160)
# t.pensize(4)
# t.pendown()
# t.color('black', 'white')
# t.begin_fill()
# a = 0.4
# for i in range(120):
# if 0 <= i < 30 or 60 <= i < 90:
# a = a + 0.08
# t.left(3) # 向左转3度
# t.forward(a) # 向前走a的步长
# else:
# a = a - 0.08
# t.left(3)
# t.forward(a)
# t.end_fill()
# t.penup()
# t.goto(30, 160)
# t.pensize(4)
# t.pendown()
# t.color('black', 'white')
# t.begin_fill()
# for i in range(120):
# if 0 <= i < 30 or 60 <= i < 90:
# a = a + 0.08
# t.left(3) # 向左转3度
# t.forward(a) # 向前走a的步长
# else:
# a = a - 0.08
# t.left(3)
# t.forward(a)
# t.end_fill()
# # 左眼内部
# t.penup()
# t.goto(-38, 190)
# t.pensize(8)
# t.pendown()
# t.right(-30)
# t.forward(15)
# t.right(70)
# t.forward(15)
# t.penup()
# t.goto(15, 185)
# t.pensize(4)
# t.pendown()
# t.color('black', 'black')
# t.begin_fill()
# t.circle(13)
# t.end_fill()
# # 右眼内部白色圆点
# t.penup()
# t.goto(13, 190)
# t.pensize(2)
# t.pendown()
# t.color('white', 'white')
# t.begin_fill()
# t.circle(5)
# t.end_fill()
# t.penup()
# t.home()
# t.goto(0, 134)
# t.pensize(4)
# t.pencolor('black')
# t.pendown()
# t.right(90)
# t.forward(40)
# # 右边的胡子(第1根)
# t.penup()
# t.home()
# t.goto(0, 124)
# t.pensize(3)
# t.pencolor('black')
# t.pendown()
# t.left(10)
# t.forward(80)
# # 右边的胡子(第2根)
# t.penup()
# t.home()
# t.goto(0, 114)
# t.pensize(3)
# t.pencolor('black')
# t.pendown()
# t.left(6)
# t.forward(80)
# # 右边的胡子(第3根)
# t.penup()
# t.home()
# t.goto(0, 104)
# t.pensize(3)
# t.pencolor('black')
# t.pendown()
# t.left(0)
# t.forward(80)
# # 左边的胡子(第1根)
# t.penup()
# t.home()
# t.goto(0, 124)
# t.pensize(3)
# t.pencolor('black')
# t.pendown()
# t.left(170)
# t.forward(80)
# # 左边的胡子(第2根)
# t.penup()
# t.home()
# t.goto(0, 114)
# t.pensize(3)
# t.pencolor('black')
# t.pendown()
# t.left(174)
# t.forward(80)
# # 左边的胡子(第3根)
# t.penup()
# t.home()
# t.goto(0, 104)
# t.pensize(3)
# t.pencolor('black')
# t.pendown()
# t.left(180)
# t.forward(80)
# # 嘴巴(下边沿圆弧和颜色填充)
# t.penup()
# t.goto(-70, 70)
# t.pendown()
# t.color('black', 'red')
# t.pensize(6)
# t.setheading(-60)
# t.begin_fill()
# t.circle(80, 40)
# t.circle(80, 80)
# t.end_fill()
# # 嘴巴(上边沿的横线)
# t.penup()
# t.home()
# t.goto(-80, 70)
# t.pendown()
# t.forward(160)
# # 舌头
# t.penup()
# t.home()
# t.goto(-50, 50)
# t.pendown()
# t.pensize(1)
# t.fillcolor("#eb6e1a")
# t.setheading(40)
# t.begin_fill()
# t.circle(-40, 40)
# t.circle(-40, 40)
# t.setheading(40)
# t.circle(-40, 40)
# t.circle(-40, 40)
# t.setheading(220)
# t.circle(-80, 40)
# t.circle(-80, 40)
# t.end_fill()
# # 领带
# t.penup()
# t.goto(-70, 12)
# t.pensize(14)
# t.pencolor('red')
# t.pendown()
# t.setheading(-20)
# t.circle(200, 30)
# t.circle(200, 10)
# # 铃铛
# t.penup()
# t.goto(0, -46)
# t.pendown()
# t.pensize(3)
# t.color("black", '#f8d102')
# t.begin_fill()
# t.circle(25)
# t.end_fill()
# # 铃铛细节
# t.penup()
# t.goto(-5, -40)
# t.pendown()
# t.pensize(2)
# t.color("black", '#79675d')
# t.begin_fill()
# t.circle(5)
# t.end_fill()
# t.pensize(3)
# t.right(115)
# t.forward(7)
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