if Statement Problem

Hi Guys

I am making a game that involves clicking many buttons with if statements and assorted loops. However, I have run into a problem. I use Codewarrior C++ and CMU Graphics Lab, and if you do, then please shoot me a PM and lend me a hand.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
if (iX>=100 && iY>=45 && iX<=300 && iY<=160)
// Coordinates of a button I have that if clicked draws "(-1,0)" and simulates moving east. The (-//1,0) is a means for me to organize the game. It resembles the 2nd quadrant of a coordinate //plant.
{
// East Area (-1,0)
testWindow.DrawString(220,300, "(-1,0)");
testWindow.DrawRectangle(0, 0,600, 440);
testWindow.SetPen(WHITE, 0); 
testWindow.SetBrush(WHITE);
if (iX>=100 && iY>=45 && iX<=300 && iY<=160)
// This is where my problem is. It is supposed to go to that screen and let the user choose the //option of where to go, Instead, when I click on the first button, it will automatically come down //to here and draws "(-2,0)" How do I fix this?
// East Area (-2,0)
testWindow.DrawString(220,300, "(-2,0)");
testWindow.DrawRectangle(0, 0,600, 440);
testWindow.SetPen(WHITE, 0); 
testWindow.SetBrush(WHITE);
}

Thanks for reading!
Last edited on
Topic archived. No new replies allowed.