JPHamlett
2011-09-22 13:22:52
Ok, so in the game Mario, the monster I am working on moves on a set y axis and changes x axis. However, when I start to run my program my monsterSprite moves to the left (as it should) till it hits the coord (0, 480) then it starts to go right (as it should). Now this is where my problem is…when it hits the xMax (100) IT DOESNT GO BACK LEFT!!!!!!!
Here's my monster class
http://pastebin.com/qXEdrFbP
Keep in mind it is just a test class so it has test positions….
The function that isnt working is
Here's my monster class
http://pastebin.com/qXEdrFbP
Keep in mind it is just a test class so it has test positions….
The function that isnt working is
public void updateMonster()
{
if ((monsterPos.X >= xMax) || (monsterPos.X <= xMin)){
if (left.Equals(true)){
left = false;
}
if (left.Equals(false)){
left = true;
}
}
if (!left)
{
monsterPos.X -= speed;
}
if (left)
{
monsterPos.X += speed;
}
}