public Game(Canvas c) { //creates/resets the matrices and map MainWindow.gamestate = MainWindow.GameState.gameOn; matrix = new Matrices(); map = new Map(c); Matrices.removeBombs(); //construct player1 in top left corner player1Point = new Point(0, 0); player1 = new Player(c, new ImageBrush(new BitmapImage(new Uri("Sprites/Player2forward.png", UriKind.Relative))), player1Point, Key.W, Key.S, Key.A, Key.D, Key.LeftShift); //construct player2 in bottom right corner player2Point = new Point(896, 512); player2 = new Player(c, new ImageBrush(new BitmapImage(new Uri("Sprites/Player1forward.png", UriKind.Relative))), player2Point, Key.Up, Key.Down, Key.Left, Key.Right, Key.RightCtrl); }
/// <summary> /// Authors /// Sebastian Horton /// resets the fuse, updates the matrix and redraws the map. /// </summary> public bool resetBomb(bool bombPlaced) { if (bombFuse <= -2) { Matrices.updateBlocks(); Matrices.updateWalkable(); Matrices.removeBombs(); Map.colourMap(); return(bombPlaced = false); } else { return(bombPlaced = true); } }
/// <summary> /// Authors /// Sebastian Horton, Elliot McArthur ///constructs the map in the mainwindow. ///Also meshes the "pillars" and "blocks" matrices and sets the walkable space at the start of the game. /// </summary> public Map(Canvas c) { Matrices.updateBlocks(); Matrices.updateWalkable(); for (int x = 0; x < 9; x++) { for (int y = 0; y < 15; y++) { Matrices.map[y, x] = new Rectangle(); Matrices.map[y, x].Height = 64; Matrices.map[y, x].Width = 64; Canvas.SetTop(Matrices.map[y, x], 64 * x); Canvas.SetLeft(Matrices.map[y, x], 64 * y); c.Children.Add(Matrices.map[y, x]); } } colourMap(); }