C++ :: Turn Based Game Turn Order?

Feb 14, 2013

How would one cycle through a turn order in a turn-based game? I was thinking an array of every creature (including the player) and have a pointer to the array++ after the turn, but I couldn't put all the objects into an array.

View 2 Replies


ADVERTISEMENT

C++ :: Turn Based Game - How To Make It Cross Platform

Sep 12, 2014

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.

View 4 Replies View Related

C++ :: Two Player Strategic Battle Turn Based Game - Assigning Controls

Nov 1, 2014

I am making a game which is a two player strategic battle turn based game..... The game will require each player to choose a attack. What would be the best key configuration for set of four attack. Like

player 1: 1,2,3,4;
player 2: 7,8,9,0;
where 1&7 are for kick 2&8 are for punch etc.....
or
player 1: q,w,e,r;
player 2: u,i,o,p;

View 2 Replies View Related

C/C++ :: How To Write A Function For A Single Turn Involving Die In A Game

May 16, 2014

So basically it consists of implementing a single turn for the game called 'pig' and printing out scores and probabilities of those scores. So this is what I have thus far :

int randomNum (int min, int max) {
return min + rand () % (max - min + 1);
} int singleTurn (int holdValue) {
int totalRoll = 0;
int score = 0;
do {
score = randomNum(1,6);

[code]....

View 13 Replies View Related

C :: How To Turn Up Error Checking On IDE

Dec 8, 2013

The reason being is that it says that my program is right

Code:
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define NFlights 10
struct date {
int month;
int day;
int year;
int hour;
int minute;

[Code] ....

View 6 Replies View Related

C++ :: How To Turn Recursive Into Iterative

Jul 10, 2014

map< int, int > cache;
int count( int n ){
if( cache[n] != 0 ){
return cache[n];

[Code] ....

I don't know how to turn this recursive function into an iterative...

View 7 Replies View Related

C/C++ :: Including All Repetitions For One Turn

Feb 22, 2015

I am trying to include all repetitions for just one turn but I keep getting

00.0 but I want (the one in red)
170.3 0 0.3
180.0 17 0.0
190.3 18 0.0
200.3 19 0.3
210.0 20 0.3
220.0 21 0.0
22 0.0

so basically I call a function that represents just one turn of getting a random number, and then when the player decides he wants to get a random number that is at least 17 and wants to repeat this 3x I have to print out this chart that shows the chances of the player rolling the numbers between 17-22 [how many times does he get 0,17,18,19,20,21,22] this is what I have

cout << "your score: " << (' ') << "chances for that score:" << endl;
/* score is the player's total score for the one turn */
int score = 0;
int score0 = 0; // 0

[Code]....

View 3 Replies View Related

C :: How To Turn User Input Into 2D Array

Mar 28, 2013

Say you the user inputs x number of names and then is to put in x amount of values for each name. How would you display these values in a 2d array and be able to add the values for each row which will represent each name?

View 5 Replies View Related

C++ :: How To Turn String Integer Into Array

Jul 23, 2013

int main () {
string integer1;
string integer2;
cout <<" enter your first number: " << endl;
cin >> integer1;
cout << endl;
cout << integer1 << " is your first number" << endl;
}

Now how do I turn the string integer into an array?

View 5 Replies View Related

C++ :: How To Turn A String Word Into Letters

Dec 9, 2013

I'm having trouble trying to turn a word into letters. I've seen other posts but they deal with a sentence and it only outputs the words only. What I want to know is how do they take a word (Ex: "word") and break it into individual letters, where I want to store them in a vector of string?

If it's not too much trouble, I would prefer without using pointers or "std:: " marks, since I am trying to avoid pointers and I'm using "using namespace std" all the time.

Ex:

In the example "word", it should output into:

"w"
"o"
"r"
"d"

and I will push them back into a vector of string where each vector element contains a letter.

View 2 Replies View Related

C :: How To Take String Of Numbers And Turn It Into Array Of Integers

Mar 2, 2014

I know strings are essentially just arrays of characters, so what would be the easiest way to take each individual digit and put it into a separate space in an array?

ex.) *str = "90210"

array[0] = 9
array[1] = 0
array[2] = 2
array[3] = 1
array[4] = 0

All my attempts at achieving this just result in an array full of garbage numbers. What I've done is

Code:
int *array;
array = malloc(sizeof(int)*(strlen(str));
for(i=0; i<strlen(str); i++) {
array[i] = str[i]
}

also, I should mention that the string will be defined in main, and its converted into an array in a separate function.

View 2 Replies View Related

C++ :: How To Make A Loop That Keeps Track Of Whose Turn It Is And Their Score

Dec 11, 2013

[URL] ....

This is my code, but how can I implement this?

View 1 Replies View Related

C++ :: Turn Binary File Data Into Unsigned Character Array For Inclusion In Executable

Jul 10, 2013

So I wrote a program to turn a binary file's data into an unsigned character array for inclusion in an executable. It works just super.

I'm wondering how I can write a program that will perform this operation on every file in a directory and all it's sub-directories so that I can I can include everything I need all at ounce.

View 9 Replies View Related

C++ :: Sorting Vectors Based On Value Of First Integer In Ascending Order

Feb 13, 2013

I have a vector which contains vectors containing 7 integers each. I'd like to sort these vectors based on the value of the first integer (int IOT), in ascending order. I know this type of question can be found everywhere, but I'm lost as to why this doesn't compile.

#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <windows.h>
using namespace std;
class orders {
public:
int IOT; // Incoming Order Time

[Code] ....

View 7 Replies View Related

C++ :: Tile Based Game Display

Apr 10, 2013

I have been writing a fairly simple turn based rpg game in c++ and at the moment it has a 2d integer array for the map, which I can display using periods for the blank areas and letters for the various people in the game, and I am trying to figure out how to upgrade to a tile based display.

View 3 Replies View Related

C/C++ :: Creating Two Dimensional Terminal Based Game?

Apr 4, 2014

i am working on class project in which i have to save the tank from canon....imy tank is moving only when i press the moving key.. and after that i see blank screen what should i do to run my process when i am not pressing moving keys....

View 8 Replies View Related

C++ :: How To Create Text Based Game Running On Console

Mar 12, 2013

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?

View 2 Replies View Related

C++ :: Text Based RPG Game - Saving Integers And Strings

Jul 14, 2013

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

C/C++ :: Text Based Game - Adding Players Names?

Mar 28, 2015

I am trying to make a very simple text based game and I want the players to be able to name their characters. Thus, I am trying to have the game ask "how many players will be playing:" and then taking that number (X) and create a place to store that information. I'm trying to get the game to ask, "What is the name of Player1?" Then once the user enters the name it would ask "What is the name of Player2" and that cycle would continue until PlayerX has entered their name. Is what I am doing close?

Here are the errors:

error C2143: syntax error : missing ';' before 'string'(ln 29 col 1)
Error2error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'std::basic_istream<char,std::char_traits<char>>' (or there is no acceptable conversion) (ln 30 col 1)

int NumberOfPlayers;
if (Response1 == "Yes") {
cout << "
How many players will be joining us on our adventure: ";

[Code].....

View 9 Replies View Related

C++ :: 2D Game - How To Handle Drawing Order Of Object Visibility

Feb 9, 2015

In 2D games, what's the best way to handle the order of drawing objects? Because most games have a background, tiles to be drawn behind the player, perhaps tiles to be drawn covering up the player, etc. My point is, with my current setup of simply looping through all objects and drawing, I have no control over what objects are drawn on top of or behind the others. My best idea so far is to hold a vector of object pointers, each vector representing a different "visibility level", like so:

class Level{
//...
std::vector<Object> allObjectInstances;
std::vector<Object*> visibilityOne; //background objects
std::vector<Object*> visibilityTwo; //objects in front of background but not necessarily all the way in front
//and so on for more objects
};

If I go through with this, I'm wondering how I could loop through all my objects and add them to each vector, then shorten whatever I have to loop through for subsequent visibility vectors. handling the order of drawing objects?

View 6 Replies View Related

C++ :: Game Design Practice For Accessing Container Of Game Objects

Dec 21, 2014

I'm working on my first video game. So far I have a few classes in the game starting with the Game class which includes a list of GameObjects (another class). There are several classes that inherit from GameObjects used to implement things like bullets, explosions, various enemy types, etc.

The game essentially iterates through the list of GameObjects to update/render them. I would like to provide access to the Game's list of GameObjects inside another class (like the Bullet class) so I can put new objects on the list. For example, when a bullet hits, I want to add an explosion to the Game's GameObject list it can be updated/rendered.

How this should be setup? I was considering adding a pointer to the Game or GameObject list to the GameObject class (and methods to access it), but I was wondering if there is a better way to set this up?

View 4 Replies View Related

C++ :: Program For Calculating Total Price Of Game Station And Game

Sep 13, 2014

I would like to make a program for calculating the total price of a game station, and a game. I made a program like this for just the price of a game in class, but I want to make one that does the game system as well.

View 7 Replies View Related

C :: Sorting Has To Be Based On Int Field

Feb 16, 2013

I have a file which has records with 2 fields--one int and one float..what is the best way to sort it?

The sorting has to be based on the int field(the first field) (each time the program runs the file might end up with some hundreds of records).

View 13 Replies View Related

C++ :: Range Based For Loops

Feb 16, 2014

In Particular:

N3337 wrote:86) this ensures that a top-level comma operator cannot be reinterpreted as a delimiter between init-declarators in the declaration of __range.

What in the world would be a valid example of when this might occur? (IE one that isn't blatantly misusing the quirks of the language).

This topic can also serve as a review topic on this presentation as well: [URL] .....

View 10 Replies View Related

C++ :: Can't Sort Node Based Upon Value

Apr 22, 2013

I can't sort node based upon there value to sort nodes on the basis of the Nodes value in ascending order

if(Current_Node->get_value() < Last_Current_Node->get_value())
{
temp = Current_Node->get_next();
Current_Node->set_next(Last_Current_Node);
Last_Current_Node->set_next(temp);}

View 3 Replies View Related

C++ :: Range Based For Loop In GCC 4.6.3

Apr 10, 2013

I would like to try out a range based for loop. I am using gcc 4.6.3. According to the link below, gcc 4.6.3 should allow me to use a range based for loop.

[URL]

However when attempting to run the code below, my IDE (Eclipse) reports the following error:

"error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options:

int a[5] ={1,2,3,4,5};
for (int x : a) {
cout<<x;
}

If gcc 4.6.3 supports range based for loops why do I get this error?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved