Commit 25b5d8e5 by BellCodeEditor

save project

parent 87046053
Showing with 44 additions and 0 deletions
#p=input('?')
#a=p[0]
#b=p[1]
#c=p[2]
#print('百:'+a+',十:'+b+',个:'+c)
import turtle
pen=turtle.Pen()
pen.penup()
pen.goto(-100,-100)
pen.pendown()
for i in range(4):
pen.forward(200)
pen.left(90)
pen.penup()
pen.goto(0,-50)
pen.pendown()
pen.fillcolor('blue')
pen.begin_fill()
pen.circle(50)
pen.end_fill()
pen.hideturtle()
turtle.done()
class Hero:
def __init__(self,name):
self.level=1
self.hp=200
self.attack=40
self.name=name
def combat(self,enemy):
enemy.hp-=self.attack
info1=self.name+'对'+enemy.name+'发起攻击,'
info2='造成'+str(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)
yase=Hero('亚瑟')
houyi=Hero('后羿')
yase.combat(houyi)
\ 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