栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 游戏开发 > Unity3D

创建3个游戏人物,以及三个游戏场景,模拟游戏场景

Unity3D 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

创建3个游戏人物,以及三个游戏场景,模拟游戏场景

class Game_person:

    def __init__(self,name,sex,age,fighting):

        self.G_name = name

        self.G_sex = sex

        self.G_age = age

        self.G_fighting = fighting

    def Game_scene1(self):

        self.G_fighting = self.G_fighting - 200

        return self.G_fighting

    def Game_scene2(self):

        self.G_fighting = self.G_fighting + 100

        return self.G_fighting

    def Game_scene3(self):

        self.G_fighting = self.G_fighting -500

        return self.G_fighting

player1 = Game_person('小A','女',18,1000)

player2 = Game_person('小B','男',20,1800)

player3 = Game_person('小C','女',19,2500)

print("-"*10 + "游戏开始" +"-"*10)

print("请选择游戏人物:")

print("1."+"小A,女,18,初始战斗力1000")

print("2."+"小B,男,20,初始战斗力1800")

print("3."+"小C,女,19,初始战斗力2500")

figure = int(input())

if figure == 1:

    print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

    scene1 = int(input())

    while scene1 == 1:

        player1.Game_scene1()

        print("战斗结束"+"n",player1.G_name,player1.G_sex,player1.G_age,"剩余战斗力:",player1.G_fighting)

        if player1.G_fighting <=0 :

            print("战斗力小于0,游戏结束")

            break

        print("是否继续:1.继续 2.退出")

        continue1 = int(input())

        if continue1 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

            if scene1 == 2:

                player1.Game_scene2()

                print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

                print("是否继续:1.继续 2.退出")

                continue2 = int(input())

                if continue2 == 1:

                    print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

                    scene1 = int(input())

                else : break

            if scene1 == 3:

                player1.Game_scene3()

                print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            if scene1 == 2:

                player1.Game_scene2()

                print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            if scene1 == 1:

                player1.Game_scene1()

                print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            print("是否继续:1.继续 2.退出")

            continue2 = int(input())

            if continue2 == 1:

                print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

                scene1 = int(input())

            else:

                    break

        else : break

    while scene1 == 2:

        player1.Game_scene2()

        print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

         else:

            break

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 2:

            player1.Game_scene2()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 1:

            player1.Game_scene1()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

    while scene1 == 3:

        player1.Game_scene3()

        print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 2:

            player1.Game_scene2()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

if figure == 2:

    print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

    scene1 = int(input())

    while scene1 == 1:

        player1.Game_scene1()

        print("战斗结束"+"n",player1.G_name,player1.G_sex,player1.G_age,"剩余战斗力:",player1.G_fighting)

        if player1.G_fighting <=0 :

            print("战斗力小于0,游戏结束")

            break

        print("是否继续:1.继续 2.退出")

        continue1 = int(input())

        if continue1 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

            if scene1 == 2:

                player1.Game_scene2()

                print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

                print("是否继续:1.继续 2.退出")

                continue2 = int(input())

                if continue2 == 1:

                    print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

                    scene1 = int(input())

                else : break

            if scene1 == 3:

                player1.Game_scene3()

                print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            if scene1 == 2:

                player1.Game_scene2()

                print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            if scene1 == 1:

                player1.Game_scene1()

                print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            print("是否继续:1.继续 2.退出")

            continue2 = int(input())

            if continue2 == 1:

                print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

                scene1 = int(input())

            else:

                    break

        else : break

    while scene1 == 2:

        player1.Game_scene2()

        print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 2:

            player1.Game_scene2()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 1:

            player1.Game_scene1()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

    while scene1 == 3:

        player1.Game_scene3()

        print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 2:

            player1.Game_scene2()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

if figure == 3:

    print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

    scene1 = int(input())

    while scene1 == 1:

        player1.Game_scene1()

        print("战斗结束"+"n",player1.G_name,player1.G_sex,player1.G_age,"剩余战斗力:",player1.G_fighting)

        if player1.G_fighting <=0 :

            print("战斗力小于0,游戏结束")

            break

        print("是否继续:1.继续 2.退出")

        continue1 = int(input())

        if continue1 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

            if scene1 == 2:

                player1.Game_scene2()

                print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

                print("是否继续:1.继续 2.退出")

                continue2 = int(input())

                if continue2 == 1:

                    print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

                    scene1 = int(input())

                else : break

            if scene1 == 3:

                player1.Game_scene3()

                print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            if scene1 == 2:

                player1.Game_scene2()

                print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            if scene1 == 1:

                player1.Game_scene1()

                print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

            print("是否继续:1.继续 2.退出")

            continue2 = int(input())

            if continue2 == 1:

                print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

                scene1 = int(input())

            else:

                    break

        else : break

    while scene1 == 2:

        player1.Game_scene2()

        print("修炼结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 2:

            player1.Game_scene2()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 1:

            player1.Game_scene1()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

    while scene1 == 3:

        player1.Game_scene3()

        print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 2:

            player1.Game_scene2()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        if scene1 == 3:

            player1.Game_scene3()

            print("游戏结束" + "n", player1.G_name, player1.G_sex, player1.G_age, "剩余战斗力:", player1.G_fighting)

        print("是否继续:1.继续 2.退出")

        continue2 = int(input())

        if continue2 == 1:

            print("请选择游戏场景:(1.草丛战斗 2.自我修炼 3. 多人游戏)")

            scene1 = int(input())

        else:

            break

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/898428.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号