-
omg....
i opened up my game code, and the whole thing was gone just a bunch of crap code liek this
Code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
WTF IS WRONG HELP
-
What are you talking about??!
I'm guessing you've overwritten one of your source files by mistake... oh well... I'm sure you've got a back-up copy? :)
-
just found one hehe :) but i am haveing a little trouble with this new battle system i want to implment heres the code and below it is what i want it to do, and what it dose now.
Code:
if (x > 90)
while (knighthealth > 0)
{
if(userhealth <= 0)
{
userhealth = 0;
cout << "\nYou have been slayed in battle!\n";
cout << "Press any key to continue...\n";
getch();
return 0;
}
cout << "You engage an Enemy\n";
cout << "Strike (1) Run(2)\n\n";
cin >> combat;
switch (combat)
{
case 1 :
cout << "\nYou attack, and do " << userattack <<" damage.\n\n";
knighthealth = knighthealth - userattack;
cout << "\nBlack Knight attacks, does "<< knightattack <<" Damage.\n";
userhealth = userhealth - knightattack;
getch();
break;
case 2 :
cout << "\nBlack Knight attacks, does "<< knightattack <<" Damage.\n";
userhealth = userhealth - knightattack;
getch();
User_Location_X++;
User_Location_Y++;
break;
}
if (knighthealth <= 0)
{
cout << "\nYou have defeated a Black Knight.\n";
cout << "You gain "<< knightexp << " Exp and "<<knightgold<<" Gold.\n";
battle = 0;
getch();
userexp = userexp + knightexp;
usergold = usergold + knightgold;
knighthealth = knightmaxhealth;
}
}}
while(knighthealth!=1);
return 0;}
ok what it dose, is you hit 1, you enagge battle, that works fine, then you choose agin, but once he dies, i want it tto go back into normal moving around modd, you just continulsy keep battleing, and that is not what i want. When you hit 2, the knight only attacks you, then you go to battleing again, i want the battle to end, and then back to the normal walking around "mode"
if you can help i'd appericate it, this is just the first step in implmenting a majoir battle system so i need this to work without any kinks
-
As far as what you asked, if you could attach the whole cpp so that i may compile/run it, it would be easier for me to debug it.
Just a few things in there:
Code:
knighthealth = knighthealth - userattack;
This code works, but it can be done better, with shorter statments:
Code:
knighthealth -= userattack;
Since your on this section, now might be a good time to add a catch for bad input when selecting 1 or 2. An example can be found in the "little problem" thread.
By return to normal walking mode, i assume you mean you want it to return to the player state before the battle? Say i walk to x pos 10 and y pos 10 right before i fight, i would be in that mode, but at say x pos 11 and y pos 9?
-
I fixed the problem, it was a mistake with were the if statment should be