Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

New Game

Name: Anonymous 2007-12-06 2:45

Hello I just started my first game.  I need your help deciding what to add to it next.  When done I want it to be like WoW only with graphics like Crysis.  Here is the code I have done so far.

#include <iostream>

using namespace std;


class Hero
{
   
public:
    int Health;
    int Attack;
};



Hero & CreateHero();



int main()

{

Hero *ThisHero = new Hero;

*ThisHero = CreateHero();

Hero *NewHero = ThisHero;

ThisHero->Health = 5;

NewHero->Attack = 10;



cout << ThisHero->Health;
cout << "\n" << ThisHero->Attack;
cin.get();

ThisHero = NULL;

delete ThisHero;

}

Hero & CreateHero()

{
    Hero *MyHero = new Hero;
    return *MyHero;
}

Name: Anonymous 2007-12-06 3:49

>>3
>>1 is gonna be making the best game ever, look, he even shared code! Bow down to our new overlord!

Name: Anonymous 2007-12-06 3:51

>>1
Fixed it for you:


#include <iostream>

using namespace std;


class GuitarHero
{
  
public:
    int Health;
    int Attack;
};



GuitarHero & CreateGuitarHero();



int main()

{

GuitarHero *ThisGuitarHero = new GuitarHero;

*ThisGuitarHero = CreateGuitarHero();

GuitarHero *NewGuitarHero = ThisGuitarHero;

ThisGuitarHero->Health = 5;

NewGuitarHero->Attack = 10;



cout << ThisGuitarHero->Health;
cout << "\n" << ThisGuitarHero->Attack;
cin.get();

ThisGuitarHero = NULL;

delete ThisGuitarHero;

}

GuitarHero & CreateGuitarHero()

{
    GuitarHero *MyGuitarHero = new GuitarHero;
    return *MyGuitarHero;
}

Name: Anonymous 2007-12-06 3:52

>>1 fails at simple C++ code.

Name: Anonymous 2007-12-06 3:52

>>4-7 Same person

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List