Commit f777c0b5 by BellCodeEditor

save project

parent c697e24e
Showing with 26 additions and 23 deletions
# 英雄角色类 import pygame
class Hero(object): pygame.init()
def __init__(self, name): pygame.display.set_mode((660,480))
self.level = 1
self.hp = 3500
self.attack = 388
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 + '阵亡'
else:
info3 = enemy.name + '还剩下' + str(enemy.hp) + '点生命值'
print(info1 + info2 + info3)
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
import turtle
import random
j=turtle.Turtle()
j.penup()
j.goto(-200,0)
wish=("你好我是小帅")
for char in wish:
font_size=random.randint(18,13)
j.pendown()
j.write(char,font=("Arial",font_size,"normal"))
jump_distanch=random.randint(20,30)
j.penup()
j.forward(jump_distanch)
j.hideturtle()
turtle.done()
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