Hello, I am a novice programmer in C++. I know only basic object-oriented ideas and my teacher thinks it is the worst thing that ever happened to mankind and because of that, I only know procedural programming. In addition, he has us use archaic compilers such as CodeWarrior from 10 years ago and a rudimentary graphics engine called "CMU Graphics Lab"

Anyway, introductions aside, I would like assistance from you guys from this trouble I have been having making an RPG as a final project. Here is a snippet of my code:

if (iX>=15)
if (iX<=135)
if (iY>=135)
if (iY<=295)
// Those are the coordinates for an Attack Button for a battle
// sequence.
{
testWindow.SetPen(WHITE, 0);
testWindow.DrawRectangle(424, 146,569 , 165, FILLED);
EBattleHP-20; // HP of enemy subtracted
EHPoutput <<"Enemy HP "<<EBattleHP << "/"<<ETotalHP; // This is akin to cout
testWindow.DrawString(425, 150, EHPoutput.str());
testWindow.SetPen(BLACK, 5);
}

Now, the problem I am having is that the HP subtracted does not stay. It flashes momentarily on the screen, and dissapears. Can any of you help me out? Anything would be appreciated.

Did you try commenting out that DrawString() function? It is probably erasing the contents of the line just above it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.