Entering If Statement Despite Not Meeting Condition
- by msmf14
This is a specific problem, but I can't seem to figure out what is wrong.
else if (X == 2)
//move left
{
if (Level[X-1][Y] == 0);
{
cout << Level[X-1][Y] << "\n";
cout << "\n MOVING LEFT from RIGHT\n"; //PROBLEM IS HERE
Level[X][Y] = 1; // block it
X = X - 1;
moved = 1;
}
}
What I am doing is I am checking if Level[X-1][Y] is 1, indicating a column, so I can not move my player there. However for some reason, despite it being 1 and not 0 (as indicated by the output), the IF statement is still accessed. Any help will be appreciated.