C++ :: How To Make A Game Map In Console Using Text
Oct 25, 2014How would I make a game map in the console using text? The map is to be changed on a turn-based system. I've been thinking about using arrays.
View 1 RepliesHow would I make a game map in the console using text? The map is to be changed on a turn-based system. I've been thinking about using arrays.
View 1 RepliesI recently wrote a "Tic Tac Toe" console game, and i seem to have a problem in my winning conditions, as when it checks if the player won (should have won) it doesn't take the appropriate action.
The winning conditions are in CoreLogic.cpp
here's the code, might not be the most pretty and clean code ever but it works for me.
there are more files i just didn't feel the need to include them all since the problem is only within CoreLogic.cpp and possibly in main.cpp
pos1-pos9 have been declared in the UserInterface.cpp and are being used to determine the correct decision to do within CoreLogic.cpp
Nothing happens when you win at this point it just exits the program.
I want to create a text-based game with C++, running on the console. I have made some other text-based console games.
Which is the most interesting text-based game to learn how to program for beginners?
I have started making a text adventure game.
if (Choice == 2) {
cout << "" << endl << "You follow the light to the end of the hallway, you find your self in a room" << endl
<< "with natural light coming from a hole in the ceiling." << endl << "" << endl << "You hear the door you just came through, slam behind you!" << endl << "" << endl
<< "There are three possible directions." << endl << "" << endl << "Do you:" << endl << "" << endl << "1) Go forward" << endl << "" << endl << "2) Go left" << endl
[Code] .....
Ignore the if (Choice == 2) at the beginning, that's linked to some previous code.
I want to make the player go back to the first bit of text but i'm not sure how to do this if they keep choosing to go back and forth from one location.
I first thought of doing it by just putting the text back in after they have chosen the option, but I can't do this infinite times.
what i got so for my code.
#include <iostream>
#include <windows.h>
using namespace System;
using namespace std;
int refreshDisplay(int , int);
const char wHole = '@';
[code]....
count <<" The oblective of the game is for the player to move around a 2 dimensional playing field and capture the star withought falling into a black hole or walking off the edge of the playing field. The controls are W = up S= down A=Left D=Right" <<endl; how implement 3 black hole X characters and 2 wormhole characters on field @ and a star *. all these char has to be randomly generated.
I made a rock paper scissors game in c++. How to make it better, and what i can do differently
#include <iostream>
#include <string>
using namespace std;
int checkConvertInput(string signs[], int wins, int draws, int losses);
void calculateWinner(int playerSign, string signs[], int &wins, int &draws, int &losses);
void endResult(int wins, int draws, int losses);
[Code] .....
I'm trying to make this run as a service so that kbhit can be interacted with even when the console is out of focus. How would I do this?
View 3 Replies View RelatedI'm making a simple single-player game. Now, assume I've made the game, how would I go about making it available to play on LAN? (I'm not really bothered about making it playable across the world with people not on the same wi-fi)
So, any way that I could get started or any libraries/APIs ....
I'm using Windows 8.1 and I'd like my game to be playable on other Windows OSs (7 and Vista if possible)
So far I only made console and windows form apps but how do I make something like a 2D game with drawn objects and not a text-based program?
View 1 Replies View RelatedI'm just playing around with C++ and I'm trying to make a sort of virtual pet game. I know its not the best looking code but I'm trying. But as of right now I'm trying to be able to animate the game a little . For example , if a user decides to "pet" their "pet" I want the pets mouth to open from '_' to ^o^ like this:
() ()
('_') -> () ()
(^o^) and switch back and forth.
Here's my code:
#include <iostream>
#include <cstring>
using namespace std;
void Greeting()
[code]....
Lets say that I try and make a BASIC game with c++, how do I make the animations/graphics for the game (i.e the characters ) Do I need a specific complier/ide (I am using visual studio)
View 11 Replies View RelatedI wanna know how to do so a cmd window when you open a game.
Example: when I start cheese attack (just a name I like) then a cmd window come up, how do I do that?
when it comes to programming. I was trying to make a simple letter guessing game where the user has 6 chances to guess the letter V. The command prompt works fine until the user enters 'y' to play. It repeats my HIGH & LOW statements twice before letting me guess again. It's all a mess.
View 2 Replies View RelatedSo I've just been messing with enet trying to figure out how to make a server and client for a game. I'm having problems whenever the server receives something from a client. For now I'm just trying to send it to all the clients for them to draw the other player, but for some reason whenever I try to an error message comes up saying a breakpoint has been triggered. I don't know why it is happening. This is the code that is giving me problems.
for (unsigned int i = 0; i < peers.size(); i++)
enet_peer_send(peers[0], 0, event.packet);
I would like to add an image to this code where the arrows are:
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
/*VARIABLES*/
float menuoption;
float minecraftoption;
int mobdetail;
[Code] ....
What is the code for adding an image (btw- I can't use Visual Studio C++ cause it lags so much!)
If code has some errors in it - I had to shorten it because it was 10,000 letters!
I'm working with a game editor program, where the player can create their own maps. Right know I'm working with collisions, and since it's unpredictable where the player place the objects like trees, houses and cars...etc have I an idea with making a rectangle selection tool. Where the player can drag a collision box around the object, so the sprite stops when it hits the box. The problem is that I dont know how to make a tool like that. so my question is how do I create a tool like that (see picture under for more information)?
btw I'm using the SDL framework
here is a picture that illustrate the tool I want to create: [URL] ....
I am starting a turn based battle (similar to pokemon) app. How could i make this and make it cross platform. Also is it possible to make it access gps and allow other devices with the same app communicate with each other?
I have done things on the command line but i never made anything with images so i dont even know where to start for this app.
I try to change the text color of console in C++. I know some commands like .
system("color fg");
But I want to change the color of only one line of console. Is this possible?
How I can clear the whole screen in console...
And I'm using clrscr(); and its not working.
How i can change the text color in the .exe without using system function
I want to open one new CMD from console application, write text into the new CMD and then coming back to the control on the old cmd. (like interactively working on the both)
look into the below code
Process P1 = Process.Start(@"C:WINDOWSsystem32cmd.exe");
P1.StartInfo.RedirectStandardInput = true;
P1.StartInfo.RedirectStandardOutput = true;
P1.StartInfo.UseShellExecute = false;
StreamWriter wr = P1.StandardInput;
wr.WriteLine("First line in New Cmd");
Console.WriteLine("First line in Old Cmd");
wr.WriteLine("Second line in New Cmd");
Console.WriteLine("Second line in Old Cmd");
it is giving the exception "StandardIn has not been redirected"
I am trying to make a basic Snake game using the command window and screen refreshes. So far I have a board, snake, food, and no walls. Basically I have it so the snake moves like the traditional snake in the game, when it eats the food once it grows. However when it eats the food a second time the game crashes. I think I have narrowed the issue down to the grow array that I have (below) but I am not sure if the issue could be a result of something else.
Grow Array
cord growArray (cord *p_values, int *size)
{
*size = *size + 1;
cord *p_new_values = new cord[ *size ];
[Code]....
I have had experience in programming from python (slightly related, html/css) and the computercraft from minecraff (basic i think it is).
My question is mainly about the C and past experience with the computercraft.
1. Is it possible to split the command console into 2 parts (a visual area and a text area)
2. Is it possible to use any form of pixel art or custom characters within any command console using C.
my a book or website where I can make a transition from console programming to GUI programming. I'm totally confused about this. I know how to program in console and can make a whole program based on console. I also know the OPP programming, but it's clear that nobody uses console programming anymore.
View 10 Replies View Relatedcout << "You've made 3 mistakes ! Game is now over !" << endl;
cout << "You had " << correctGuesses << " correct guesses before the game was over" << endl;
this info into a text file...
example of a guessing game code...
#include <iostream>
#include <time.h>
using namespace std;
int main() {
cout << "This is a very simple number guessing game. Each time you will be given a number of the range 0-10." << endl;
cout << "The objective of the game is to guess whether the next number is going to be higher or not. As simple as that." << endl;
[Code] ....
I'm trying to create a sort of text-adventure game, but rather than having to check for the input being uppercase or lowercase, I'd rather convert it before checking it in an if statement.
I've created a function, and I know it works because when I print the output, it shows up capitalized, however when I check it with an if statement, it doesn't pass.
Here is my code:
#include <iostream>
using namespace std;
void stringUppercase(string x) {
int i;
for (i = 0; i < x.length(); i++) {
[Code] ....
I am working on a text-based RPG game and I want to allow the player to save his progress. So I need to save several integers and a string. And my problem starts here "How can I save integers and load them?". I read the tutorial but I dont understand. I need to write a function to save game?
View 8 Replies View Related