adventure

Why is my variable not updating when I use a switch statement?

空扰寡人 提交于 2021-01-29 09:03:39
问题 I am a student, and I am trying to make an adventure text game, without using arrays. This code is a function, called by main (within another switch case statement). The problem is, the day doesn't update. It only updates when the code is included inline in main . int getArea (int nArea) //area and day { int nShisha, nBall, nLolipop, nPepsi ; int nUser; //test variables int nPrice; // testing variable for price int naUser ; int nDay; nDay = 2; printf("Choose your Area\n"); printf("1. Riyadh

text based adventure help and tips

风格不统一 提交于 2019-12-13 10:04:02
问题 I decided to make a text based adventure and I realized I didn't know much about making one. I do, however, know that I want to make it with a batch file, just because I think it is easier to work with and share. I don't have many questions right now but I'm sure I'll come up with more as time goes on (if I decide this is fun) but right now I have two questions: How do you make lines appear as if someone was typing it? How do you make the line wait x seconds before going to the next process

Connect Rooms Randomly in Adventure Game

狂风中的少年 提交于 2019-12-12 04:48:38
问题 I have the following code where I randomly create 7 room names, and give them a type (start, middle, end). I now need to randomly connect these rooms to each have anywhere between 3 and 6 connections. I am at a loss of what to do. I have found an example of how to do it using bitcode, but as in my other post, I still do not understand that version. If anyone could help, that would be greatly appreciated. Below is the relevant code for the rooms: Here is where the I declare the rooms: void

OCaml: design datatypes for a text adventure game

不羁的心 提交于 2019-12-10 22:13:28
问题 I am trying to make a simple naive text adventure game (base one this page) to learn OCaml. The game is about making an game engine, so all the information about rooms, items ect, is store in a json file. Sample json file would be like this: { "rooms": [ { "id": "room1", "description": "This is Room 1. There is an exit to the north.\nYou should drop the white hat here.", "items": ["black hat"], "points": 10, "exits": [ { "direction": "north", "room": "room2" } ], "treasure": ["white hat"] },

How do I implement a dispatch table for a text adventure game?

梦想的初衷 提交于 2019-12-07 11:38:47
问题 I am making a text adventure in C#, and someone suggested that I use a dispatch table instead of a switch statement. Here's the switch statement code: #region Public Methods public static void Do(string aString) { if(aString == "") return; string verb = ""; string noun = ""; if (aString.IndexOf(" ") > 0) { string[] temp = aString.Split(new char[] {' '}, 2); verb = temp[0].ToLower(); noun = temp[1].ToLower(); } else { verb = aString.ToLower(); } switch(Program.GameState) { case Program