public Enemy(double X, double Y, double Direction, double Speed, TileBoard Board) { x = X; y = Y; direction = Direction; speed = Speed; board = Board; curTile = board.board[(int)x, (int)y]; }
public void overlayOnMe(TileBoard overlayTileBoard, int originX, int originY, int width, int height) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { board[x + originX, y + originY] = new Tile(overlayTileBoard.board[x + originX, y + originY]); } } }
public void overlayOnMe(TileBoard overlayTileBoard, int originX, int originY) { for (int x = 0; x < overlayTileBoard.boardSizeX; x++) { for (int y = 0; y < overlayTileBoard.boardSizeY; y++) { board[x + originX, y + originY] = new Tile(overlayTileBoard.board[x, y]); board[x + originX, y + originY].x = x + originX; // Updates their x and y board[x + originX, y + originY].y = y + originY; } } }
public int SetbyID(int ID, Tile tile, TileBoard setBoard) { int minX = boardSizeX; int maxX = 0; int difX; int minY = boardSizeY; int maxY = 0; int difY; for (int x = 0; x < boardSizeX; x++) { for (int y = 0; y < boardSizeY; y++) { if (board[x, y].ID == ID) { if (x < minX) { minX = x; } if (x > maxX) { maxX = x; } if (y < minY) { minY = y; } if (y > maxY) { maxY = y; } } } } difX = (maxX - minX) + 1; difY = (maxY - minY) + 1; TileBoard foundBoard = new TileBoard(difX, difY); for (int x = 0; x < difX; x++) { for (int y = 0; y < difY; y++) { foundBoard.board[x, y] = new Tile(board[x + minX, y + minY]); } } foundBoard.FloodBoard(new Tile(tile)); setBoard.overlayOnMe(foundBoard, minX, minY); return(difX * difY); }
public static void DisplayBoard(PictureBox area, TileBoard board, gameWindow window) { Graphics gfx = area.CreateGraphics(); int displayX = 0; int displayY = 0; for (int x = 0; x < board.boardSizeX; x++) { displayY = 0; for (int y = 0; y < board.boardSizeY; y++) { DisplayTile(gfx, board.board[x, y], window); displayY += TileSize; } displayX += TileSize; } }
public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // gameBoard = new TileBoard(BoardSize, BoardSize); gameBoard.FloodBoard(new Tile(0, "empty")); mainWindow = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, borderSize, 0), allignPoint(this.ClientRectangle, 100 - borderSize, 100)), picMain, 100, 100); leftWindow = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, 0, 0), allignPoint(this.ClientRectangle, borderSize, 100)), picMain, borderSize, borderSize); rightWindow = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, 100 - borderSize, 0), allignPoint(this.ClientRectangle, 100, 100)), picMain, borderSize, borderSize); mainWindow.setState("Title"); leftWindow.setState("OJ"); rightWindow.setState("Scores"); lostWidth = this.Width - this.ClientRectangle.Width; lostHeight = this.Height - this.ClientRectangle.Height; mouseDown = false; }