473,910 Members | 4,188 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++ game

14 New Member
I underlined and bold print my files.
I need to know how to make this code into a working game.
The object of the game is to have two players 1- belle and 2-beast.
I want them to lose and gain strength and health, when 0 die.
I need to know how to make them interact.
I need to know what to do with teraform (creek, pasture, brick road) how to add.
I need the public interface to look like the forest.
classes need to function the program needs to function.
The purpose of this assignment is to use the character concept below in stars and implement the main (in stars).

*************** *************** *************** *************** *************** ************
#include <iostream>
#include <string>
using namespace std;


class Character {
private:
string hair,eyes;
int strength, health;
public:
Character();
Character(strin g, string, int, int);
Character(const Character&);

void setHair(string) ;
void setEyes(string) ;
void setStrength(int );
void setHealth(int);

string getHair()const;
string getEyes()const;
int getStrength()co nst;
int getHealth()cons t;

void addStrength(int );
void addHealth(int);
void loseStrength(in t);
void loseHealth(int) ;
void interact(Charac ter&);

void print()const;
void read();
};

Character:: Character (string 1, string 2, int a, int b){
1= hair;
2= eyes;
A= strength;
B= health;
}

Character:: Character (const Character & d) {
1= d.hair;
2= d.eyes;
3= d.strength;
4= d.health;
}

Void Character:: setHair (string 1){
1= hair;
}

Void Character:: setEyes (string 2){
2= eyes;
}

Void Character:: setStrength (int a){
A= strength;
}

Void Character:: setHealth (int b){
B= health;
}

String Character:: getHair () const{
String 1;
Return 1;
}

String Character:: getEyes() const{
String 2;
Return 2;
}

Int Character:: getStrength () const{
Int a;
Return a;
}

Int Character:: getHealth () const{
Int b;
Return b;
}

Void Character:: addStrength (int a){
Strength= strength +1;
}

Void Character:: addHealth (int b){
Health = health +1;
}

Void Character:: loseStrength (int a){
Strength= strength – 1;
}

Void Character:: loseHealth (int b){
Health= health – 1;
}

Void Character:: print () const {
Cout<< “Enter patient’s hair color”<<endl;
Cin>> hair;
Cout<< “Enter patient’s eye color”<<endl;
Cin>> eyes;
Cout<< “Enter the patient’s strength”<<endl ;
Cin>> strength;
Cout<< “Enter the patient’s health”<<endl;
Cin>> health;
}

Int main (){
//Character Person A, Person B(“black”, “brown”, 100, 100);
//Person B.print();
//character Person C (Person B);
//Person C.print();
Return 0;
}

*************** *************** ******MAIN***** *************** *************** **************
int main(){
Game g1(parameters);
Character p1 (parameters), p2 (parameters);
Venue forest (parameters);

g1.setLevel(5);
g1.setPlayerOne (p1);
g1.setPlayerTwo (p2);
g1.setLocation (forest);
meet(g1.playero ne, g1.playertwo);
cout<<g1.player one<<g1.Playert wo<<endl;
g1.teraform(50) ;
cout<<g1.Locati on<<endl;
int s=g1.Playerone. getStrength();
...........
*************** *************** *************** *************** *************** *************** *
HERE IS THE OTHER CODE I HAVE SO FAR
Game.cpp
#include <string>
using namespace std;
#include "game.h"


Game:: Game (string 1, string 2, string 3, int a, int b, int c, int t){
1= PlayerOne;
2= PlayerTwo;
3= location;
a= level;
b= health;
c= strength;
t= teraform;
}
Game:: Game (const Game & d) {////maybe change the d see what it does- change rest of code
1= PlayerOne;
2= d.PlayerTwo;
3= d.location;
a= d.level;
b= d.health;
c= d.strength;
t= d.teraform;
}
Void Game:: setPlayerOne (string 1){
1= PlayerOne;
}
Void Game:: setPlayerTwo (string 2){
2= PlayerTwo;
}
Void Game:: setlocation (string 3){
3= location;
}
Void Game:: setlevel (int a){
a= level;
}
Void Game:: sethealth (int b){
b= health;
}
Void Game:: setstrength (int c){
c= strength;
}
Void Game:: setteraform (int t){
t= teraform;
}
String Game:: getPlayerOne () const{
string 1;
return 1;
}
String Game:: getPlayerTwo () const{
string 2;
return 2;
}
String Game:: getlocation () const{
string 3;
return 3;
}
String Game:: getlevel () const{
int a;
return a;
}
String Game:: gethealth () const{
int b;
return b;
}
String Game:: getstrength () const{
int c;
return c;
}

Int Game:: getlevel () const {
int a;
return a;
}
Int Game:: gethealth () const {
int b;
return b;
}
Int Game:: getstrength () const {
int c;
return c;
}
Int Game:: getteraform () const {
int d;
return d;
}
Void Game:: addlevel (int a) {
level= level +1;/////////// zero
}
Void Game:: addhealth (int b) {
health= health +1;
}
Void Game:: addstrength (int c) {
strength= strength +1;
}
Void Game:: addteraform (int t) {
teraform= teraform +1;////category rain fog sunny snow or do we need it
}
Void Game:: looselevel (int a) {
level= level -1;
}
Void Game:: loosehealth (int b) {
health= health -1;
}
Void Game:: loosestrength (int c) {
strength= strength -1;
}
Void Game:: looseteraform (int t) {
teraform= teraform -1;
}
Void Game:: print () const {
Cout<< PlayerOne <<endl;//change cout<<PlayerOne <<endl;
Cin>> PlayerOne;////change cin>>PlayerOne;
}


character.cpp
#include <string>
using namespace std;
#include "character. h"

Character:: Character (string 1, string 2, string 3, int a, int b, int c,){
1= PlayerOne;
2= PlayerTwo;
3= location;
a= level;
b= health;
c= strength;
}
Character:: Character (const Character & d) {////maybe change the d see what it does- change rest of code
1= PlayerOne;
2= d.PlayerTwo;
3= d.location;
a= d.level;
b= d.health;
c= d.strength;
}
Void Character:: setPlayerOne (string 1){
1= PlayerOne;
}
Void Character:: setPlayerTwo (string 2){
2= PlayerTwo;
}
Void Character:: setlocation (string 3){/////maynot need
3= location;
}
Void Character:: setlevel (int a){
a= level;
}
Void Character:: sethealth (int b){
b= health;
}
Void Character:: setstrength (int c){
c= strength;
}
String Character:: getPlayerOne () const{
string 1;
return 1;
}
String Character:: getPlayerTwo () const{
string 2;
return 2;
}
String Character:: getlocation () const{
string 3;
return 3;
}
String Character:: getlevel () const{
int a;
return a;
}
String Character:: gethealth () const{
int b;
return b;
}
String Character:: getstrength () const{
int c;
return c;
}

Int Character:: getlevel () const {
int a;
return a;
}
Int Character:: gethealth () const {
int b;
return b;
}
Int Character:: getstrength () const {
int c;
return c;
}
Void Character:: addlevel (int a) {
level= level +1;/////////// zero
}
Void Character:: addhealth (int b) {
health= health +1;
}
Void Character:: addstrength (int c) {
strength= strength +1;
}
Void Character:: looselevel (int a) {
level= level -1;
}
Void Character:: loosehealth (int b) {
health= health -1;
}
Void Character:: loosestrength (int c) {
strength= strength -1;
}

[
Sep 21 '06 #1
1 2898
fowle040
14 New Member
B]venue.cpp[/b]
#include <string>
using namespace std;
#include "venue.h"

Venue:: Venue (string 1, string 2, string 3,string 4, int a, int b, int c,){
1= PlayerOne;
2= PlayerTwo;
3= location;
4= teraform;
a= level;
b= health;
c= strength;
}
Venue:: Venue (const Venue & d) {////maybe change the d see what it does- change rest of code
1= PlayerOne;
2= d.PlayerTwo;
3= d.location;
4= d.teraform;
a= d.level;
b= d.health;
c= d.strength;
}
Void Venue:: setPlayerOne (string 1){
1= PlayerOne;
}
Void Venue:: setPlayerTwo (string 2){
2= PlayerTwo;
}
Void Venue:: setlocation (string 3){/////maynot need
3= location;
}
Void Venue:: setlevel (int a){
a= level;
}
Void Venue:: sethealth (int b){
b= health;
}
Void Venue:: setstrength (int c){
c= strength;
}
Void Venue:: setteraform (string 4){
4= teraform;
}
String Venue:: getPlayerOne () const{
string 1;
return 1;
}
String Venue:: getPlayerTwo () const{
string 2;
return 2;
}
String Venue:: getlocation () const{
string 3;
return 3;
}

Int Venue:: getlevel () const {
int a;
return a;
}
Int Venue:: gethealth () const {
int b;
return b;
}
Int Venue:: getstrength () const {
int c;
return c;
}
Void Venue:: addlevel (int a) {
level= level +1;/////////// zero
}
Void Venue:: addhealth (int b) {
health= health +1;
}
Void Venue:: addstrength (int c) {
strength= strength +1;
}
Void Venue:: looselevel (int a) {
level= level -1;
}
Void Venue:: loosehealth (int b) {
health= health -1;
}
Void Venue:: loosestrength (int c) {
strength= strength -1;
}

game.h
include <iostream>
using namespace std;

#ifndef GAME
#define GAME

class Game{
Private:
String PlayerOne, PlayerTwo, venue, teraform
Int level, strength, health
Public:
Game ();
Game (string, string, string, string, int, int, int);
Game (const Game &);




friend ostream & operator<< (ostream&, const Game &);
friend istream& operator>> (istream &, Game &);
};
#endif
character.h
#include <iostream>
using namespace std;

#ifndef CHARACTER
#define CHARACTER

class Character {
private:
string hair, eyes;
int strength, health, level, location, teraform;
public:
Character();
Character (string, string, int, int, int, int);
Character(const Character &);

Character & operator++ ();////change
Character difference (const Character & ) const;
Character operator+ (const Character & ) const;
bool operator> (const Character & ) const;


friend ostream & operator<< (ostream&, const Character &);
friend istream& operator>> (istream &, Character &);
};
#endif
venue.h
#include <iostream>
using namespace std;

#ifndef VENUE
#define VENUE

class Venue {
private:
string Kansas, Woods, Palace
int night, day
public:
Venue();
Venue (string, string, string, int, int,);
Venue(const Venue &);

Venue & operator++ ();////change
Venue difference (const Venue & forest) const;
Venue operator+ (const Venue & forest) const;
bool operator> (const Venue & forest) const;

friend ostream & operator<< (ostream&, const Venue &);
friend istream& operator>> (istream &, Venue &);
};
#endif
Sep 21 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

138
6663
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the yeah,-that's-non-obvious dept. theodp writes "As if there weren't enough dodgy patents, here's an excerpt from one granted to Microsoft Tuesday for a 'Method and apparatus for displaying information regarding stored data in a gaming system': 'When saving a game,...
7
7076
by: Brandon J. Van Every | last post by:
Anyone know of any "good" open source C# game projects out there? Something that actually has a game engine and some content done, so I can just fiddle with it and do interesting / goofy things. I hesitate to state genre preferences. I've been all over SourceForge and it's slim pickings in C# land, at least for projects that have actually gotten something done. I'll be doing my last round of sifting and searching tonight, then I'm...
1
3706
by: Jerry Fleming | last post by:
Hi, I have wrote a game with python curses. The problem is that I want to confirm before quitting, while my implementation doesn't seem to work. Anyone can help me? #!/usr/bin/python # # Brick & Ball in Python # by Jerry Fleming <jerryfleming@etang.com>
7
2868
by: Gasten | last post by:
Hello. The last weeks I've been coding a roguelike (you know, like nethack) in python using the nCurses library. Some week ago I ran into a problem: When I made the object for messagebar-output, I found a bug that I can't figure out (believe me; I've tried everything and asked for help several times on the IRC-channel). The updateMsg() and iMsg() takes a list of message-lines as argument (or process a string to a list), and it'll output...
5
8947
by: Kraken | last post by:
Hi, i have a bit of a problem here. I have an assignment to do an animal guessing game using an original database and updating it as the user enters new animals in it. The program enters the file data into an array of structures, with the animal and question in the same variable(question) and the bool isAnimal tells me whether its an animal or a question. If its a question it is followed by two numbers; one for the position of the line to go...
5
4591
by: alesitaam | last post by:
Help!!!! Im new using python, currently writing a program which tests one game, IQ test. When the module is run, the program should ask user to choose the game to start. Also, I'm using Try...Except statements, and os file operator. My code needs some adjustments, most of all at the end. Please give some tips!!! import os while True: print"Welcome to trivia game!" print "0-Choose a game to play:" print "1- IQ Test.trv"
2
5329
by: LilMeechc20 | last post by:
Hello, I have a group assignment that I have to do. We have to write a Tic Tac Toe game. One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I managed to write a code for a single player (human -vs- computer) game. My problem is, now we want to merge the two games with options to pick which game you would like to play. However, the games were written totally different styles and I can't...
0
10037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9879
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11055
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10541
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9727
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5939
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.