0
void Map::Movement()
{
int ch;
switch (ch = _getch())
{
case KEY_W: //up
    if (Player::posy != 1)
    {
        if (AboveM == false)
        {
            Player::posy--; 
            DisplayMap(); 
        }
    }
    break;

case KEY_S: //down
    if (Player::posy != 20)
    {
        if (BelowM == false)
        {
            Player::posy++; 
            DisplayMap(); 
        }
    }
    break;

case KEY_A: //left
    if (Player::posx != 1)
    {
        if (LeftM == false)
        {
            Player::posx--; 
            DisplayMap(); 
        }
    }
    break;

case KEY_D: //right
    if (Player::posx != 20)
    {
        if (RightM == false)
        {
            Player::posx++; 
            DisplayMap();
        }
    }
    break;

I can't for the life of me figure out where to put this so that the borders for the mob will work correctly (first question I know it isn't asked well since I haven't added the rest of the code but it should be simple to figure out)I've been putting it every place I could think of the last week or so as well as trying out everything else I could that would run I either get weird random errors or it runs as if the monster as no borders at all.

    if ((Player::posy = Enemy::enemyBuild::posy) && (Player::posx = Enemy::enemyBuild::posx +1))
{
    bool RightM = true;
}
if ((Player::posy = Enemy::enemyBuild::posy) && (Player::posx = Enemy::enemyBuild::posx -1))
{
    bool LeftM = true;
}
if ((Player::posx = Enemy::enemyBuild::posx) && (Player::posy = Enemy::enemyBuild::posy +1))
{
    bool BelowM = true;
}
if ((Player::posx = Enemy::enemyBuild::posx) && (Player::posy = Enemy::enemyBuild::posy -1))
{
    bool AboveM = true;
}
skypjack
  • 49,335
  • 19
  • 95
  • 187
  • Just to make things more clear the top is where the movement mechanic is as the bottom is the thing I can't figure out where to place – Spencer Hopkins Nov 09 '15 at 19:51
  • When you used the debugger, which statements are causing the issue? – Thomas Matthews Nov 09 '15 at 20:40
  • @Thomas Matthews I'm not getting any errors, it's running but it's not doing what I'm asking which is stopping the player one away from the Monster – Spencer Hopkins Nov 09 '15 at 20:51
  • More reason to use a debugger. Your issue is about stopping. You should be able to see the reason when you single step through the code. – Thomas Matthews Nov 09 '15 at 20:55
  • 1
    The lower section of your code with your if statements you are using the assignment operator and not the comparison operator. I don't know if this is what you are intending but try using `==` instead of `=` in these if statements. – Francis Cugler Nov 10 '15 at 01:29
  • @Francis Cugler I've tried it before and it doesn't change the outcome – Spencer Hopkins Nov 11 '15 at 05:33
  • @Thomas Matthews The problem is that it's ignoring it entirely because it's in the wrong place I don't know where to put it though for it to work, it doesn't matter where i try to put it the outcome is the same in that it just ignores the monster entirely – Spencer Hopkins Nov 11 '15 at 05:33

0 Answers0