Iam having some difficulties with my XNA project; I want to change the level when my main character moves into the left or right corner (going to the next or previous level respectively). However, due to a problem I cannot seem to understand, the character is not able to go backwards to the previous level (look at the if player.Position.X == 1200 statement - this never occurs). Walking forward seems to work just fine. Any ideas what I might be doing wrong?
private void UpdateLevelOne()
{
if (player.Position.X == 0)
{
showLevelOne = false;
showLevelTwo = true;
player.Position = new Vector2(1200, ground - player.Size.Height);
levelTwo.backgroundVector = new Vector2(-750,0);
}
}
private void UpdateLevelTwo()
{
if (player.Position.X <= 250)
{
showLevelTwo = false;
showLevelOne = true;
player.Position = new Vector2(1200, ground - player.Size.Height);
levelOne.backgroundVector = new Vector2(-750, 0);
}
if (player.Position.X == 1200)
{
showLevelTwo = false;
showLevelOne = true;
player.Position = new Vector2(10, ground - player.Size.Height);
}
}