static void Initialize(Engine engine) { int startRow = 2; int startCol = 2; int endCol = WorldCols - 10; int alienStartRow = startRow; //for (int i = startCol + 4; i < endCol - 10; i++) //{ // if (i == startCol + 15) // { // alienStartRow++; // } // if (i == startCol + 20) // { // alienStartRow--; // } // AlienShip alien = new AlienShip(new MatrixPosition(alienStartRow, i), new MatrixPosition(0, 1)); // engine.AddObject(alien); //} for (int i = startCol; i < endCol; i++) { AlienShip alien = new AlienShip(new MatrixPosition(alienStartRow, i), new MatrixPosition(0, 1)); HiveShip hiveAlien = new HiveShip(new MatrixPosition(alienStartRow + 1, i), new MatrixPosition(0, 1)); engine.AddObject(alien); engine.AddObject(hiveAlien); } PlayerShip player = PlayerShip.Instance(new MatrixPosition(WorldRows - 2, WorldCols / 2)); engine.AddObject(player); }
public MainWindow() { playerlife = 2; InitializeComponent(); Globals.playerMissiles = new List <PlayerMissile>(); PlayerShip statekgracza = PlayerShip.Instance(); Designs designs = new Designs(); highscores = new Dictionary <string, int>(); #region Adding Textures Uri uri = new Uri(@"/Cruiser.PNG", UriKind.Relative); designs.addDesign("Cruiser", uri); uri = new Uri(@"/Destroyer.PNG", UriKind.Relative); designs.addDesign("Destroyer", uri); uri = new Uri(@"/PlayerShip.PNG", UriKind.Relative); designs.addDesign("PlayerShip", uri); uri = new Uri(@"/bullet.PNG", UriKind.Relative); designs.addDesign("Missile1", uri); uri = new Uri(@"/bullet.PNG", UriKind.Relative); designs.addDesign("Missile2", uri); uri = new Uri(@"/Booster.PNG", UriKind.Relative); designs.addDesign("Booster", uri); #endregion #region Adding Commands moveLeft = new MoveLeft(statekgracza); moveRight = new MoveRight(statekgracza); shoot = new Shoot(statekgracza); exit = new Exit(this); commands = new PlayerCommands(); #endregion #region Adding Scores highscores.Add("Kamil", 20); highscores.Add("Piotr", 30); highscores.Add("Rafał", 40); #endregion #region Initialize Window main = this; LifePoints = "5"; mapa = new Canvas(); lifecounter = LifeCounter; pointscounter = PointCounter; mapa.Width = 800; mapa.Height = 600; mapa.Background = new SolidColorBrush(Colors.White); mapa.Focusable = true; Grid.SetRow(mapa, 0); Grid.SetRow(mapa, 0); Grid.SetColumnSpan(mapa, 6); Root.Children.Add(mapa); statekgracza.CreateShipDynamically(mapa); GameMaster gameMaster = new GameMaster(mapa, statekgracza); Thread t = new Thread(new ThreadStart(gameMaster.RunGame)); t.Start(); #endregion }