so ive checked this code 100 times for mistakes and everything checks out and should be working, I've tried everything I can think of but for some reason nothing works, this makes the movement super buggy and none of my attack works
this is a snippet from my initiation class
Frame();
Counter = 1;
//Player One's turn
while (Counter == 1)
{
Map::Movement();
Attack::Playerattack();
}
//Player two's turn
while (Counter == 2)
{
Map::Movement2();
Attack2::Playerattack();
}
part of my movement class
int ch;
switch (ch = _getch())
{
//Player 1 movement
case KEY_W: //up
if (Player::posy != 1)
{
Player::posy--;
DisplayMap();
Start::Counter++;
}
break;
case KEY_S: //down
if (Player::posy != 20)
{
Player::posy++;
DisplayMap();
Start::Counter++;
}
break;
case KEY_A: //left
if (Player::posx != 1)
{
Player::posx--;
DisplayMap();
Start::Counter++;
}
break;
case KEY_D: //right
if (Player::posx != 20)
{
Player::posx++;
DisplayMap();
Start::Counter++;
}
break;
1st attack class
int ch;
switch (ch = _getch())
{
case KEY_1:
if (((Player::posx == Player2::posx) && (Player::posy == Player2::posy + Player::roa1)) || ((Player::posx == Player2::posx) && (Player::posy == Player2::posy - Player::roa1)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx + Player::roa1)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx - Player::roa1)))
{
Player2::hp = Player2::hp - Player::doa1;
std::cout << "You have used: Attack 1" << std::endl;
std::cout << "Player 2 HP is now: " << Player2::hp << std::endl;
Start::Counter++;
}
//if enemy is in range of attack 2 below the monster
case KEY_2:
if (((Player::posx == Player2::posx) && (Player::posy == Player2::posy + Player::roa2)) || ((Player::posx == Player2::posx) && (Player::posy == Player2::posy - Player::roa2)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx + Player::roa2)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx - Player::roa2)))
{
Player2::hp = Player2::hp - Player::doa1;
std::cout << "You have used: Attack 2" << std::endl;
std::cout << "player 2 HP is now: " << Player2::hp << std::endl;
Start::Counter++;
2nd Attack class
int ch;
switch (ch = _getch())
{
case KEY_K:
if (((Player2::posx == Player::posx) && (Player2::posy == Player::posy + Player2::roa1)) || ((Player2::posx == Player::posx) && (Player2::posy == Player::posy - Player2::roa1)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx + Player2::roa1)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx - Player2::roa1)))
{
Player::hp = Player::hp - Player2::doa1;
std::cout << "Player 1 HP is now: " << Player2::hp << std::endl;
Start::Counter--;
}
case KEY_L:
if (((Player2::posx == Player::posx) && (Player2::posy == Player::posy + Player2::roa2)) || ((Player2::posx == Player::posx) && (Player2::posy == Player::posy - Player2::roa2)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx + Player2::roa2)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx - Player2::roa2)))
{
Player::hp = Player::hp - Player2::doa1;
std::cout << "player 1 HP is now: " << Player2::hp << std::endl;
Start::Counter--;
if anyone has ANY ideas what im doing wrong or have overlooked please tell me and I will try it, I'm working in visual studio 2012.
breaks in your attack classswitchstatements. \$\endgroup\$