问题标签 [text-based]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 我想知道如何使用循环在 C++ 中制作星号直角三角形(S)
我想要这样的东西:
我试过这个:
但它甚至没有接近。请帮忙
python-2.7 - 如何创建帐户来存储信息?
我目前正在使用游戏币创建一个基于文本的游戏,并且我希望用户有一种方法来存储他们的信息,以便他们以后可以登录。这可以在不连接到 Internet 的情况下实现吗?
java - 创建在另一个对象内部的对象
为了代码可读性和调试问题,我想将尽可能多的东西保存在单独的 java 文件中。
我有一个名为Actor的 java 类。Actor 类被设计为一个包含所有玩家信息的对象,但也可用于其他事物,如怪物等。
另一个名为Status的类。此类处理所有状态异常,并将修改 Actor 的属性(例如:如果他们被击晕)。
我希望这个状态类成为 Actor 的一部分,而不是嵌套类。这可能吗?
vb.net - 点击按钮打开一个新表格?
我正在尝试创建一个基于文本的游戏,用户选择按钮,这将导致游戏的其他部分,现在我需要程序关闭旧表单,新表单必须放在旧表单的位置曾是。
java - while循环在需要时没有结束
所以一些背景信息,我是编程新手,还在学习,所以我为我的小错误道歉。我正在制作自己的基于文本的游戏,只是为了进一步练习等。
以下是 dropbox 上所有内容的链接以获取更多上下文: https ://www.dropbox.com/sh/uxy7vafzt3fwikf/B-FQ3VXfsR
我目前正在尝试为我的游戏实现战斗系统,并且遇到了战斗序列在需要时没有结束的问题。“战斗序列”是一个 while 循环,如下所示:
其中 checkAlive() 方法如下:
我试图让它在“英雄”或“怪物”生命值变为 <= 0 时结束战斗序列,但是它目前正在完成 while 循环,因此即使他杀死了英雄也会产生被击中的结果怪物在他的第一击。
这就是当前正在“打印到屏幕”的内容
老鼠失去 5 生命值!你杀了老鼠!
英雄失去 1 点生命值!
非常感谢任何帮助,在此先感谢。
c++ - 如何在 C++ 中实现随机多响应
我正在用 C++ 创建一个基于文本的游戏。但是,我想知道是否有办法从一组响应中随机化一个响应。
假设我有一个问题,而玩家回答不正确,我希望游戏以类似于“对不起,那是无效的”的方式回复。
然而,这并没有给游戏增加太多个性,因为在这种情况下,计算机是这个特定游戏中的人工智能,当你输入错误时,我会让计算机说“我不明白”,“什么是你在谈论',以及其他一些回应。
现在我的问题是,我怎样才能让它从我拥有的那些回复中随机选择一个回复?
python - 如何在 python 中为拼字游戏创建基于文本的板?
我目前正在使用 python 制作一个基于文本的拼字游戏,我想知道如何为这样的游戏制作一个棋盘。我必须单独绘制每个瓷砖,还是有更好的方法?
谢谢
c++ - 如何让敌人在一定距离内随机循环并跟随玩家?C++ 控制台游戏
我一直坚持试图让 Z 随机移动几个小时。我的目标是做什么;-
- 使僵尸(Z)在地图上随机移动
- 如果玩家(M)距离一定距离,则跟随玩家(M)
我是一个完全的编程爱好者,我一定会感谢你的帮助!这是完整的代码:
java - I'm wanting to test which of two integers is closest to a third int in Java
I feel like this has an extremely obvious answer, so forgive me if I'm being stupid. I'm creating a simple text-based game for elementary school kids in which the user, playing as a mage, needs to ward off mighty dragons by mixing together various spell cards (in my case, multiplying their values together to try and get the closest to the dragon's weakness number). This weakness number changes every turn, until the dragon hits an HP less than or equal too 0, at which point another dragon will spawn and the player will have to ward that one off too. The entire project takes up five classes, one for the player, another for the cards, another for the dragon, another for the game's play methods, and a fifth, the driver. The first thing that comes to mind for me is to make a method in Player.java that goes something like this:
followed by an if statement in my game class' play method:
I realize that this would work, but I want to make sure I'm not missing something blatantly obvious and simpler that I could do. Some method in the Integer class maybe? Please keep in mind this is a very early version of the project, and I hope to implement Slick2D graphics later. Here's all of my code thus far: From Game.java:
And Player.java:
Dragon.java:
And lastly, Card.java:
Primarily, the issue I'm running into is the play() loop of the Game class, where I need to calculate the damage that the player does. Obviously, (before I program in elemental logic), I want that damage to actually do damage instead of ending up as a negative number and making the dragon gain HP. Any and all help would be greatly appreciated. Thank you! -Nick
python - Python初学者,基于文本的游戏
我对编程游戏还很陌生;我已经完成了 3/4,Learn Python the Hard Way
我有一个关于我制作的基于文本的小游戏的问题......所以在这个游戏中,我guy
被困在一个荒岛上,你可以选择(原始输入)去left
right
或into the jungle
. 选择方向后,您可以选择步行多少英里。每个方向都应该有不同的最终结果(和英里距离)。
如果您输入的数字小于到目的地的里程数,系统会提示您选择“转身”或“继续前进”。如果您输入turn around
,您将被带回到起点,您' 再次被要求选择一个方向。如果你输入keep going
,程序返回到miles(),你可以选择一个新的步行里程。
好的,这里有两个问题:
我将如何做到这一点,以便如果用户最初输入的英里数小于目标距离,并且第二英里输入 + 第一英里输入 == 到目的地的英里数,它将添加输入并运行我的目的地函数,而不仅仅是重复英里()。
由于所有三个最终目的地都有不同的距离,我应该编写三个单独的英里函数吗?有没有办法让它根据选择的原始方向,miles() 将运行不同的端点?
如果这没有一点意义,我很抱歉......我仍在学习,我不确定如何完全解释我想要表达的内容。