1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
void GameMovements()
{
bool FirstInitialization = true;
int Player1XCoordinate = 55, Player2XCoordinate = 55;
int Player1YCoordinateU = 28, Player1YCoordinateD = 29;
while (true)
{
BulletPattern(Player1XCoordinate);
if (FirstInitialization == true)
{
GameBorderAndStatus();
SetCoordinate(Player1XCoordinate, Player1YCoordinateU);
cout << " ^ \n";
SetCoordinate(Player1XCoordinate, Player1YCoordinateD);
cout << "^==|==^ \n";
FirstInitialization = false;
}
//MOVEMENTS FOR PLAYER 1
else if (GetAsyncKeyState(VK_LEFT) && Player1XCoordinate != 16)
{
system("cls");
GameBorderAndStatus();
Sleep(10);
Player1XCoordinate -= 3;
SetCoordinate(Player1XCoordinate, Player1YCoordinateU);
cout << " ^ \n";
SetCoordinate(Player1XCoordinate, Player1YCoordinateD);
cout << "^==|==^ \n";
}
else if (GetAsyncKeyState(VK_RIGHT) && Player1XCoordinate != 94)
{
system("cls");
GameBorderAndStatus();
Player1XCoordinate += 3;
Sleep(10);
SetCoordinate(Player1XCoordinate, Player1YCoordinateU);
cout << " ^ \n";
SetCoordinate(Player1XCoordinate, Player1YCoordinateD);
cout << "^==|==^ \n";
}
else if (GetAsyncKeyState(VK_UP) && Player1YCoordinateU != 24)
{
system("cls");
GameBorderAndStatus();
Player1YCoordinateU -= 2;
Player1YCoordinateD -= 2;
Sleep(10);
SetCoordinate(Player1XCoordinate, Player1YCoordinateU);
cout << " ^ \n";
SetCoordinate(Player1XCoordinate, Player1YCoordinateD);
cout << "^==|==^ \n";
}
else if (GetAsyncKeyState(VK_DOWN) && Player1YCoordinateU != 28)
{
system("cls");
GameBorderAndStatus();
Player1YCoordinateU += 2;
Player1YCoordinateD += 2;
Sleep(10);
SetCoordinate(Player1XCoordinate, Player1YCoordinateU);
cout << " ^ \n";
SetCoordinate(Player1XCoordinate, Player1YCoordinateD);
cout << "^==|==^ \n";
}
}
}
void BulletPattern(int Player1MuzzleLocation)
{
for (int i = 25; i != 3; i--)
{
Sleep(10);
SetCoordinate(Player1MuzzleLocation + 3, i);
}
}
|