CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    3

    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.

    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!

  2. #2
    Join Date
    May 2010
    Posts
    3

    Re: if Statement Problem

    Guys, sorry for posting 2 threads. I didn't see the "Wait for moderator approval" message until the second time submitting the thread. The first, I thought I did something stupid and somehow didn't get the thread through.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured