Visual C++ :: Number Of Players - Making Score Stay With Each Player
Oct 21, 2013
I am writing a game that is 2 to 4 players. i am wondering how to ask how many players, and make the score stay with each player. it is a rip off of zombie dice, this is what i have so far the playerScore array is to hold the score for each player and the turn array is hold hold the values that they rolled that turn, i also dont know how to clear out the turn array when it goes to the next player.
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
using namespace std;
int main() {
int playerScore[4];
[Code] ....
View 3 Replies
ADVERTISEMENT
May 9, 2014
So I've been trying to write a good update loop,
if (SDL_GetTicks() - startTime >= 1000) {
fps = loops;
startTime = SDL_GetTicks();
loops = 0;
[Code] ....
It's based off of deWitter's 4th game loop. [URL]....
However, there's one major flaw. If the update() function takes a long time to execute, the timer slows down, a "second" doesn't last 1000 milliseconds, and the fps counter spits out numbers like 100 and 120 when the limit should be 60. Is there a way to make a timer that always runs with constant speed no matter how long the update function takes?
View 2 Replies
View Related
Oct 21, 2013
I was tasked with creating a program that asks for the scores of three gamers then takes these scores and outputs the highest. I THINK I have the other parts down but I don't know how to get the program to compare the scores and output the highest without having to write a long list of commands comparing playerone to playertwo, then player one to playerthree, then player two to playerone, etc.
#include <iostream>
using namespace std;
int main () {
int playerOne, playerTwo, playerThree;
cout << "Please enter score for Player One: ";
cin >> playerOne;
[Code] .....
View 10 Replies
View Related
Feb 11, 2015
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
class Player {
private:
char name[20];
int score;
[Code] .....
View 5 Replies
View Related
Jul 22, 2013
I have programmed a game where you guess a number (1-6) and if the number is equal to the random number then give the player score + 10. But if I have selected for example 4 players then if the game will give player 1 a score it gives player 2 a score instead? What can be causing this error?
Code:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int cube;
int number[4];
[Code] .....
View 6 Replies
View Related
Aug 8, 2013
We are told to modify this code following the instructions given within the code. It is a tictactoe program.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// Create a structure that stores a player's name (up to 20 characters) and score (# of wins)
// Call the struct Player
void info(void) {
printf("
[Code] ....
I've ended up with the following code, but the part about the name of the datafile is giving errors upon running the program.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// Create a structure that stores a player's name (up to 20 characters) and score (# of wins)
// Call the struct Player
typedef struct {
[Code] ....
View 4 Replies
View Related
Jul 20, 2013
I'm trying to make a very simple game in SFML, and i have a problem. Whenever i try to create sf::Sprite for the class where all properties of Player (his sprite, health, speed, etc.) It gives me error.
#include <sfml.h>
#include <list>
class Playerclass{
public:
int xspeed, yspeed;
float health;
sf::Sprite entsprite();
[Code] ....
The error is with player.entsprite.setTexture(texture) : "'player.Playerclass::entsprite' does not have class type".
View 2 Replies
View Related
Dec 10, 2013
i cant figure out what im doing wrong with my bubble sort. when i cout the sorted test scores, the first number(testScore[0])this is the code.
#include <iostream>
using namespace std;
int main()
{
[Code]....
View 2 Replies
View Related
Dec 11, 2013
Something that does something like this
at this point run a loop for all players, in this loop use random to determine the face and depending on the face run a loop (for roll again etc) or give next user the chance.
And this loop is 2-12 people, all rolling die.
They draw 3 die out of a cup of 12.
Then they roll the 3 die, getting fish, hook, or boot on each die.
View 1 Replies
View Related
Nov 19, 2013
I have a code which is a set of rgb frames to be displayed at 25 fps to make it look like a video. While I createWindow invalidate and update it based on a timer, the video plays fine, but the buttons of Play, Pause etc hangs during the time video is playing.?
View 11 Replies
View Related
Oct 25, 2013
I am developing a VC++ application with windows media player component. play video from a video buffer data which i have?
View 2 Replies
View Related
Jan 21, 2013
How can I check if window media player is running in full screen mode & topmost in c++ MFC?
What I used is this logic:
I compared media player full screen coordinates to that of monitor coordinates.If they are same implies media player is in fullscreen.But it has one flaw.Whenever there are control(for play,pause) displayed in full screen in media player, coordinates are not coming same as that of monitor.
View 10 Replies
View Related
Oct 8, 2014
I'm trying to understand why this won't work, the output i get is a list of even numbers. I'm trying to get all prime numbers below the number thats scanned in.
#include <stdio.h>
int isPrime(int number);
int main(){
[Code]....
View 5 Replies
View Related
Sep 26, 2014
For example if I have typed 0xFF (a literal hex number that represents the value 255 for Unsigned Char or -1 for Signed Char) in part of my program. That 0xFF is treated as a Char not an Int, because the value is within the range supported by Char, the C compiler always tries to use the smallest datatype possible for the number that is needed for a literal value like this.
Unfortunately because Signed Char is the default Char type, 0xFF is translated into -1. I am wanting to use it to represent 255. So I'm trying to tell the compiler that 0xFF should be interpreted as either an Int or an Unsigned Char. How do I do this?
I already tried typing it with the magic letter "I", like this: 0xFFI
But that didn't work. What is the correct way to do this?
View 4 Replies
View Related
Oct 10, 2013
My program closes after the out even though i've used cin.get():
I want the program to stay open at least until you press enter, even after the whole output.
Code:
#include <iostream>#include <string>
int main()
{
std::cout << "Please enter your name";
std::string name;
std::cin>> name;
// build the message that we intend to write
[Code] .....
View 4 Replies
View Related
Jan 21, 2015
I have a function that rotates a vector 90 degrees. Only problem is, i never get negative values. For some strange reason, no matter what i do, the value of x is positive. And even if the x is negative. Once i put it into direction (struct with 2 values x and y) it turns again to positive. Im using VSC++2013 ultimate. At first direction was SDL_Point, so i thought it was SDL problem, but now it seems its something else.
if (c == '-') {
int x = direction.y;
x *= -1;
int y = direction.x;
direction = { x, y };
}
View 8 Replies
View Related
Aug 27, 2014
#include <stdio.h>
float total, avg, max, min;
float judge[4];
int index;
int array[4];
int main() {
total = 0.0;
max = array[0];
min = array[0];
[Code] ....
I dont understand how to make the array when it prints out only print out the final average and the final maximum score with the final minimum score but what its doing at the moment is just giving an average for each individual score taken...
Minimum and maximum scores are displaying 0.0
And it displays these things 4 times in a row i just want it to be displayed once.
View 1 Replies
View Related
Nov 21, 2012
I'm using MFC, and I need to make the combo box drop down list to be draw up - above the contro, instead of below it. How to make this happen?
View 4 Replies
View Related
Jun 28, 2014
One exercise says that, "Define a right triangle class. Make an octagonal shape out of eight right triangles of different colors."
Making such a class isn't difficult. I wrote it as follows:
Code:
#include "Simple_window.h"
class right_triangle : public Shape {
public:
[Code]...
But it sounds that making an octagon using eight right triangles isn't possible!
View 9 Replies
View Related
Oct 24, 2013
when making a text editor do you have to create a parser for it or are parsers just used in compilers and interpreters?
View 6 Replies
View Related
Dec 6, 2013
Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient the following data should be entered:
-Number of Days spent in a Hospital
-The daily rate
-Charges for the hospital services(lab test, etc)
-Hospital medication charges
If the the patient was an out-patient the following data should be entered:
-Charges for Hospital services(lab test, etc)
-Hospital medication charges
The program should use two functions to calculate the total charges. One of the functions should accept arguments for the in patient data, while the other function accepts arguments for out-patient data. Both functions should return the total charges.
I dont know why but the result always gives me 0??? This is what I have.
#include<iostream>
using namespace std;
double in_patient(int Numdays, double dailyRate, double Charge_hospServices, double HospMed_Charge);
double out_patient(double Outcharge_Service, double OuthospMed_Charge);
int main() {
double dailyRate, Charge_hospServices,HospMed_Charge,Outcharge_Service,OuthospMed_Charge;
[Code] .....
View 4 Replies
View Related
Jun 10, 2013
I've been trying to make a little quiz application that takes questions from a file and them presents question by question on a static pannel, a few buttons that have the possible answers on them written as the questions go, and on the bottom a little place where we can see whats our score.when we finish the quiz, the score gets writen in a data.dat file and thats that.
View 14 Replies
View Related
Jul 8, 2013
I am using a CEdit control as a child in a CListCtrl for purpose of making each column editable. The application is a dialog based app. My problem is... I have overwritten OnOK and OnCancel in the main dialog so the edit control never receives notifications for Escape or Enter whether in OnChar or PreTranslateMessage and I would like to delete the CEdit control after updating the CListCtrl on Enter. What can I do? I have rewritten this code many many times over the past 4 days and nothing is working.
View 4 Replies
View Related
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
Mar 25, 2013
I am writing a snakes and ladder program and I'm almost finished, but I am struggling with the dice to work in the way I want it to work. I want the dice to work like this :
Before each player throw the dice they must start at 0.
Each player must throw a 6 on the dice to move on the board.
If a player threw a 6 on the dice, that player can throw again.
But I ended up with two seperate dice, one for each player (game is only for two players).And when I run the program, both players don't start at 0. And when I throw the dice, both players move at the same time but with different values.
If one of my players threw a 6, they just keep on throwing until someone wins the game. I tried to use a switch and if statements but I couldn't get it right. And so I did this :
Code:
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#define SpaceBar 32// 32 is an ASCII value for a spacebar
[Code] ....
View 5 Replies
View Related
Oct 29, 2014
Write a program that will search soccer players data to check whether a name supplied by the user is on that list. For doing the search, the user may provide either the player’s full last name or one or more starting letters of the last name. If a matching last name is found, the program will display the player’s full name and date of birth. Otherwise, it will display “Not found”.
Requirements specification:At the start, the program will ask the user to enter information about 10 soccer players constituting soccer player data. Each soccer player data will consist of the following fields:
Last name
First name
Birth month
Birth day
Birth year
The user will be asked to enter each soccer player data on a separate line with the field values separated by a space.
Once the data is entered, the program will display a menu of choices as below:
Chose an option:
(1 – input data, 2 – display original data, 3 – sort data , 4 – display sorted data 5 – search by last name 6 – exit the program )
If the user chooses option 1, the program will ask the user for a data and populate the array of structures that will hold the data for each of the soccer players.
If the user chooses option 2, the program will display data in the order provided by the user (original data).
If use chooses option 3, the program will sort data by last name.
If user chooses number 4 the program will display the data sorted by last name.
If the user chooses option 5, the program will ask the user to enter one or more starting letters of the soccer player’s last name. It will then search the soccer player data for the matching last name. If a match is found, it will display the first player found with the matching pattern. If a match is not found, the program will display “Not found”. If the user enters two forward slashes (//) for the last name, it will no longer search for the name. Instead it will display the main option menu.
If the user chooses option 6, the program will display “Thank you for using this program” and will end.
Why my program isint executing correctly. Here is what i've so far . . . .
#include <iostream>
#include <string>
using namespace std;
struct data {
string lname;
string fname;
int birthmonth;
int birthday;
int birthyear;
[Code]...
View 3 Replies
View Related