有没有办法在基于批处理文本的冒险游戏中创建一个类系统(例如,选择你的角色是战士,法师,弓箭手等)? [英] Is there a way of creating a class system in a batch text based adventure game, (E.g choosing if your character is a Warrior, Mage, Archer ect)?

查看:95
本文介绍了有没有办法在基于批处理文本的冒险游戏中创建一个类系统(例如,选择你的角色是战士,法师,弓箭手等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码到目前为止,



@echo off

TITLE The Adventure


:启动

cls

echo。

echo #################################

echo#------------------------------------------#

echo#----------- #WELCOME TO#------------#

echo#------- --- #THE冒险#----------#

echo#---------------------- -------------------#

echo ##################### ###########

echo。

echo。

cecho {03} [1]开始新游戏{#}

echo。

cecho {03} [2]退出游戏{#}

echo。

set / p menuselection =输入:

if%menuselection%equ 1 goto raceselect

if%menuselection%equ 2 exit

goto startup



:raceselect

cls

echo。

echo在这里,你将有机会创造你自己的英雄。

echo请从头开始输入相应的数字,明智地选择。

echo你不想最终得到一个霍比特人的战士,想象一下。

echo他会挥舞他的剑敌人的膝盖。

echo无论如何,玩得开心。

echo。

echo你知道吗,现在你只能

echo作为H播放uman Warrior。

echo。

echo。

echo好的,我们将从选择你的英雄比赛开始。

echo。

cecho {03} [1]人类{#}

echo。

cecho {0C} [2] Hobbit-- --------------------------------------- {#}

回声。

cecho {0C} [3]矮人----不能像这些赛车那样玩! ---- {#}

echo。

cecho {0C} [4] Elf ----------------- ------------------------ {#}

echo。

set / p raceselection =输入:

如果%raceselection%equ 1 goto humanclassselect

goto raceselect



:humanclassselect

cls

echo。

echo好的,所以你选择了你的英雄种族(人类),你现在要去

echo选择你的英雄课。

echo。

echo [1]战士

echo([2] Rogue)------ -------------------------------------

echo([3]弓箭手)----不能像这些课一样玩! ----

echo([4] Mage)------------------------------- ------------

echo。

set / p humanclassselection =输入:

if%humanclassselection%equ 1 goto humanwarriorstart



非常基本的东西,但我目前的编码方式,我必须至少制作16个相同的广告系列你选择的每个不同的种族和阶级。所以我想知道是否有一种简单的方法来做到这一点,所有这些都保持在同一个故事中,但根据你选择的班级和种族,你的统计数据会发生变化吗?此外,我很抱歉复制和粘贴整件事,但这是我能告诉你我所做的唯一方法。

解决方案
?没有。

你正试图在一个批处理文件中写一个基于文本的冒险 - 并相信我,这比你需要的更多工作。



我强烈建议放弃这种方法 - 随着你的冒险变得越来越大,这将变得越来越复杂和容易出错 - 并考虑转向一种适当的编程语言,它可以支持子程序,以及类和属性等等,没有你通过尝试在命令文件中执行相同的操作而给自己带来麻烦。真的,这真的会让你的生活变得更轻松,不仅仅是长期的,而且在短期内也是如此!



看看这个: http://www.gamedev.net/topic/650104 -text-based-adventure-game-microsoft-visual-studio-c / [ ^ ] - 这是一个帮助初学者为学校项目创建他的第一个基于文本的冒险。它不会在板上交给你,但它应该给你一些指示。


Here is my code so far,

@echo off
TITLE The Adventure

:startup
cls
echo.
echo #################################
echo #------------------------------------------#
echo #----------- #WELCOME TO# ------------#
echo #---------- #THE ADVENTURE# ----------#
echo #-----------------------------------------#
echo ################################
echo.
echo.
cecho {03}[1] Start a new game{#}
echo.
cecho {03}[2] Exit game{#}
echo.
set /p menuselection= Enter:
if %menuselection% equ 1 goto raceselect
if %menuselection% equ 2 exit
goto startup

:raceselect
cls
echo.
echo Here, you will have the chance to create your very own hero.
echo Please begin by entering the corresponding numbers, choose wisely.
echo You don't want to end up with a hobbit warrior, imagine it.
echo He'd be flailing his sword at the enemies knees.
echo Anyway, have fun.
echo.
echo Just so you know, for now you are only able to
echo play as a Human Warrior.
echo.
echo.
echo Okay, we will begin by selecting your heroes race.
echo.
cecho {03}[1] Human{#}
echo.
cecho {0C}[2] Hobbit-----------------------------------------{#}
echo.
cecho {0C}[3] Dwarf ---- CANNOT PLAY AS THESE RACES YET! ----{#}
echo.
cecho {0C}[4] Elf -----------------------------------------{#}
echo.
set /p raceselection= Enter:
if %raceselection% equ 1 goto humanclassselect
goto raceselect

:humanclassselect
cls
echo.
echo Okay, so you have chosen your heroes race (Human), you are now going
echo to select you heroes class.
echo.
echo [1] Warrior
echo ([2] Rogue ) -------------------------------------------
echo ([3] Archer) ---- CANNOT PLAY AS THESE CLASSES YET! ----
echo ([4] Mage ) -------------------------------------------
echo.
set /p humanclassselection= Enter:
if %humanclassselection% equ 1 goto humanwarriorstart

Pretty basic stuff, but the way I'm currently coding it, I would have to make at least 16 of the same campaign just for each different race and class you choose. So I was wondering if there was an easy way of doing this so that it all stays in the same story but depending on the class and race you choose, your stats change? Also, I'm sorry for copy and pasting the whole thing but that's the only way I could show you what I have done.

解决方案

Basically? No.
You are trying to write a text based adventure in a batch file - and trust me on this, that is a whole load more work than you need it to be.

I would strongly suggest that abandon that approach - which is going to get increasingly complicated and error prone as your adventure gets bigger - and consider moving to a "proper" programming language, which can support subroutines, and classes, and attributes, and so forth without the hassle you give yourself by trying to do the same things in a command file. It really, really, will make your life a lot easier, not just in the long run, but in the short term as well!

Have a look at this: http://www.gamedev.net/topic/650104-text-based-adventure-game-microsoft-visual-studio-c/[^] - it's a beginner being helped to create his first text based adventure for a school project. It's won't hand it to you on a plate, but it should give you some pointers.


这篇关于有没有办法在基于批处理文本的冒险游戏中创建一个类系统(例如,选择你的角色是战士,法师,弓箭手等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆