用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - python代码库

小游戏

2021-04-02 作者: 帅丘举报

[python]代码库

import random

# 初始数据
H = 100  # hp值
Hyang = 20
Hniuo = 50
Hma = 100
Hlang = 250
G = 100  # 金币
L = 20  # 力量
nell = '游戏结束'
MAXH = 100
MAXL = 20
# 模块

# 本体
print('hi,冒险者!')
print('欢迎来到新世界!')
print('准备好来一次有趣的冒险了吗?')
start_q = '1'
while start_q == '1':
    if start_q == '1':
        print('1,查看属性')
        print('2,商店')
        print('3,开始冒险')
        start = input('请输入数字选项:')
        if MAXH < H:
            MAXH = H
        if MAXL < L:
            MAXL = L
    while start == '1':
        if start == '1':
            print('属性:')
            print('hp :', H)
            print('金币:', G)
            print('力量:', L)
            start = '0'
            break
    while start == '2':
        if start == '2':
            print('1,购买生命药剂')
            print('增加hp50')
            print('价格:50G')
            print('当前hp:', H)
            print('2,购买力量药剂')
            print('增加力量10')
            print('价格:100G')
            print('当前力量:', L)
            print('3,返回')
            start_sd = input('请输入数字选项:')
            while start_sd == '1':
                if start_sd == '1':
                    if G < 50:
                        print('抱歉!您的金币不足!')
                        print('请稍后再来吧!')
                    elif G >= 50:
                        H = H + 50
                        G = G - 50
                        break
                    break
                break
            while start_sd == '2':
                if start_sd == '2':
                    if G < 100:
                        print('抱歉!您的金币不足!')
                        print('请稍后再来吧!')
                    elif G >= 100:
                        L = L + 10
                        G = G - 100
                        break
                    break
                break
            while start_sd == '3':
                if start_sd == '3':
                    start = '1'
                    break
                break  #
    while start == '3':
        if start == '3':
            print('选择地图:')
            print('1,平原')
           # print('2,森林')
           # print('3,山脉')
           # print('4,沼泽')
           # print('5,返回')
            start_dt = input('请输入数字选项:')
        while start_dt == '1':
            if start_dt == '1':
                print('当前地图为:平原')
                print('1,🐏羊(LV1)')
                print('2,🐂牛(LV2)')
                print('3,🐎马(LV3)')
                print('4,🐺狼(LV5)')
                print('5,返回')
                start_dt_py = input('请输入数字选项:')
                while start_dt_py == '1':
                    if start_dt_py == '1':
                        print('🐏')
                        print('hp:20')
                        print('G:1-10')
                        print('L:0')
                        print('1,确定   2,返回')
                        Hyang = 20
                        GW = input('请输入数字选项:')
                        while GW == '1':
                            if GW == '1':
                                Hyang = Hyang - L
                                print('你对🐏造成了%s点伤害' % L)
                                print('🐏剩余hp:', Hyang)
                                HQ = random.randint(1, 10)
                                G = G + HQ
                                print('恭喜你获得了:金币', HQ)
                                break
                            break
                        while GW == '2':
                            if GW == '2':
                                start = '1'
                                break
                            break
                        break
                while start_dt_py == '2':
                    if start_dt_py == '2':
                        print('🐂')
                        print('hp:50')
                        print('G:5-15')
                        print('L:0')
                        print('1,确定   2,返回')
                        Hniuo = 50
                        GW = input('请输入数字选项:')
                        while GW == '1':
                            if GW == '1':
                                while Hniuo > 0:
                                    Hniuo = Hniuo - L
                                    print('你对🐂造成了%s点伤害' % L)
                                    print('🐂剩余hp:', Hniuo)
                                    if Hniuo <= 0:
                                        HQ = random.randint(10, 20)
                                        G = G + HQ
                                        print('恭喜你获得了:金币', HQ)
                                        continue
                                break
                            break
                        while GW == '2':
                            if GW == '2':
                                start = '1'
                                break
                            break
                        break
                while start_dt_py == '3':
                    if start_dt_py == '3':
                        print('🐎')
                        print('hp:100')
                        print('G:10-20')
                        print('L:0')
                        print('1,确定   2,返回')
                        Hma = 100
                        GW = input('请输入数字选项:')
                        while GW == '1':
                            if GW == '1':
                                while Hma > 0:
                                    Hma = Hma - L
                                    print('你对🐎造成了%s点伤害' % L)
                                    print('🐎剩余hp:', Hma)
                                    if Hma <= 0:
                                        HQ = random.randint(10, 20)
                                        G = G + HQ
                                        print('恭喜你获得了:金币', HQ)
                                        continue
                                break
                            break
                        while GW == '2':
                            if GW == '2':
                                start = '1'
                                break
                            break
                        break
                while start_dt_py == '4':
                    if start_dt_py == '4':
                        print('🐺')
                        print('hp:250')
                        print('G:20-50')
                        print('L:10')
                        print('1,确定   2,返回')
                        Hlang = 250
                        GW = input('请输入数字选项:')
                        while GW == '1':
                            if GW == '1':
                                while Hlang > 0:
                                    Hlang = Hlang - L
                                    print('你对🐺造成了%s点伤害' % L)
                                    print('🐺剩余hp:', Hlang)
                                    if Hlang <= 0:
                                        HQ = random.randint(20, 50)
                                        G = G + HQ
                                        print('恭喜你获得了:金币', HQ)
                                        continue
                                    H = H - 10
                                    print('🐺对你造成了10点伤害')
                                    print('你剩余hp:', H)
                                    if H <= 0:
                                        print(nell)
                                        print('数据:')
                                        print('最大hp:', MAXH)
                                        print('剩余金币:', G)
                                        print('最大力量:', MAXL)
                                        exit()
                                else:
                                    start = '1'
                                    break
                        while GW == '2':
                            if GW == '2':
                                start = '1'
                                break
                            break
                        break
                    while start_dt_py == '5':
                        if start_dt_py == '5':
                            start = '1'
                            break
                        break
                    break
                break
            while start_dt == '5':
                if start_dt == '5':
                    start = '1'
                    break
                break
            break
        break


网友评论    (发表评论)

共3 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...