public void Jump() { midAir = true; int count = 0; while (count < 5) { Thread.Sleep(20); if (positionY > 1) { if (Map.mapArray[positionY - 2][positionX - 1] == ' ' && Map.mapArray[positionY - 2][positionX] == ' ' && Map.mapArray[positionY - 2][positionX + 1] == ' ') { DrawEngine.RemovePlayerAt(this); positionY--; DrawEngine.DrawPlayer(this); } count++; } GameEngine.ExecuteControlsOnJump(this); } Drop(); midAir = false; }
public void MoveRight() { if (positionX < 118) { if (Map.mapArray[positionY][positionX + 2] == ' ' && Map.mapArray[positionY + 1][positionX + 2] == '#') { DrawEngine.RemovePlayerAt(this); positionY--; DrawEngine.DrawPlayer(this); } if (Map.mapArray[positionY][positionX + 2] == ' ' && Map.mapArray[positionY - 1][positionX + 2] == ' ' && Map.mapArray[positionY + 1][positionX + 2] == ' ') { DrawEngine.RemovePlayerAt(this); positionX++; DrawEngine.DrawPlayer(this); } if (!midAir) { Drop(); } } SearchA(); SearchE(); }
public static void Game() { Player player = new Player(); DrawEngine.DrawMap(); DrawEngine.DrawPlayer(player); ExecuteControls(player); }
public void Drop() { while (true) { Thread.Sleep(20); if (Map.mapArray[positionY + 2][positionX - 1] == ' ' && Map.mapArray[positionY + 2][positionX] == ' ' && Map.mapArray[positionY + 2][positionX + 1] == ' ') { DrawEngine.RemovePlayerAt(this); positionY++; DrawEngine.DrawPlayer(this); } else { break; } } }