Commit a65b748d by BellCodeEditor

auto save

parent c89015b8
Showing with 46 additions and 21 deletions
# 英雄角色类 import tkinter
class Hero(object): from tkinter import messagebox
def __init__(self, name):
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)
with open("user.txt","r",encoding="utf-8") as f:
info = f.read()
user = json
yase = Hero("垭瑟") def login_to_reg():
houyi= Hero("后羿") app_login.root.destory()
yase.combat(houyi) globals app_reg
\ No newline at end of file app_reg = My_register()
app_reg.show()
def reg_to_login()
app_reg.root.destory()
lobals app_reg
app_reg = My_register()
app_reg.show()
def register():
name.password1.password2 = app_reg_input()
if name ==""or password1==""or password2=="":
messagebox.showwarning("警告""请填写完整的注册资料")
elif name in users:
messagebox.showerror()
elif password1 != password2
messagebox.showwarning()
elif:
users[name] = password1
def register():
pass
def register():
pass
\ No newline at end of file
d
\ No newline at end of file
class Player(Hero):
def __init__(self,name):
self.level = 1
self.name = name
self.hp = 200
self.attack = 50
player = Player("后羿")
print("玩家的血量值为:",player.hp)
print("玩家的攻击力为:",player.attack)
\ 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