Esempio n. 1
0
        public void addArrow(int column, int row, Variables.Direction dir, Gameboard gameboard, int dirtex)
        {
            if (column < Variables.columns || row < Variables.rows)
            {
                Cell cell = gameboard.getCell(row, column);
                if (!cell.isBase && !cell.isSpawn)
                {
                    if (!hasArrow(cell) && rdy)
                    {
                        if (p_arrows.Count >= MAX_ARROWS)
                        {
                            Cell c = p_arrows[p_arrows.Count - 1];
                            removeArrow(c, gameboard);
                        }

                        p_arrows.Insert(0, cell);
                        cell.setOwnedBy(index);
                        gameboard.updateTile(column, row, dir, arrows[dirtex - 1]);
                    }
                    else
                    {
                        removeArrow(cell, gameboard);
                        p_arrows.Insert(0, cell);
                        cell.setOwnedBy(index);
                        gameboard.updateTile(column, row, dir, arrows[dirtex - 1]);
                    }
                }
            }
        }
Esempio n. 2
0
 //draws the frame, if the direction is None = -1, we make sheet 0 so it won't break the array.
 public void DrawFrame(SpriteBatch batch, Variables.Direction direction)
 {
     int sheet = (int)direction;
     if (sheet < (int)Variables.Direction.Up)
     {
         sheet++;
     }
     DrawFrame(batch, Frame, sheet);
 }
Esempio n. 3
0
        //Updates the position of the Sprite on the gameboard
        public void updatePosition(Variables.Direction direction)
        {
            if (direction == Variables.Direction.Right)
            {
                this.coord = new Vector2(this.coord.X + Variables.speed, this.coord.Y);
            }

            if (direction == Variables.Direction.Left)
            {
                this.coord = new Vector2(this.coord.X - Variables.speed, this.coord.Y);
            }

            if (direction == Variables.Direction.Down)
            {
                this.coord = new Vector2(this.coord.X, this.coord.Y + Variables.speed);
            }

            if (direction == Variables.Direction.Up)
            {
                this.coord = new Vector2(this.coord.X, this.coord.Y - Variables.speed);
            }
        }
Esempio n. 4
0
        //FOLLOWING SECTION IS TO BE REMOVED, IT IS THE PLAYER 1 MOUSE DEBUG TOOL FOR DEVELOPER WITHOUT XBOX CONTROLLER
        //*************************************************************************************************************
        public void addArrow(Vector2 position, Variables.Direction dir, Gameboard gameboard, int dirtex)
        {
            int tempCol = (int)position.X / Variables.cellWidth;
            int tempRow = (int)position.Y / Variables.cellHeigth;
            Cell temp_c = gameboard.getCell(tempRow, tempCol);

            if (!hasArrow(temp_c) && rdy)
            {

                if (p_arrows.Count >= 4)
                {
                    Cell c = p_arrows[p_arrows.Count - 1];
                    int c_column = c.getPositionY();
                    int c_row = c.getPositionX();

                    gameboard.updateTile(c_column, c_row, Variables.Direction.None, Tile.cellBorder);

                    p_arrows.Remove(c);
                }

                p_arrows.Insert(0, temp_c);
                gameboard.updateTile(position, dir, arrows[dirtex - 1]);
            }
        }
Esempio n. 5
0
        public void updateTile(Vector2 position, Variables.Direction direction, Texture2D texture)
        {
            int column = (int) position.X / Variables.cellWidth;
            int row = (int) position.Y / Variables.cellHeigth;

            Cell cell = Rows[row].Columns[column];

            if (!cell.isBase && !cell.isSpawn)
            {
                switch (direction)
                {
                    case Variables.Direction.None:
                        Rows[row].Columns[column].setTileID(0, texture);
                        break;
                    case Variables.Direction.Up:
                        Rows[row].Columns[column].setTileID(1, texture);
                        break;
                    case Variables.Direction.Right:
                        Rows[row].Columns[column].setTileID(2, texture);
                        break;
                    case Variables.Direction.Down:
                        Rows[row].Columns[column].setTileID(3, texture);
                        break;
                    case Variables.Direction.Left:
                        Rows[row].Columns[column].setTileID(4, texture);
                        break;
                }
            }
        }
Esempio n. 6
0
        public void updateTile(int column, int row, Variables.Direction direction, Texture2D texture)
        {
            if (column >= Variables.columns || row >= Variables.rows) return;
            //int column = (int) position.X / Variables.cellWidth;
            //int row = (int) position.Y / Variables.cellHeigth;

            //Console.WriteLine("Position == " + position.X + ", " + position.Y);

            Cell cell = Rows[row].Columns[column];

            if(!cell.isBase && !cell.isSpawn)
            {
                switch (direction)
                {
                    case Variables.Direction.None:
                        Rows[row].Columns[column].setTileID(0, texture);
                        break;
                    case Variables.Direction.Up:
                        Rows[row].Columns[column].setTileID(1, texture);
                        break;
                    case Variables.Direction.Right:
                        Rows[row].Columns[column].setTileID(2, texture);
                        break;
                    case Variables.Direction.Down:
                        Rows[row].Columns[column].setTileID(3, texture);
                        break;
                    case Variables.Direction.Left:
                        Rows[row].Columns[column].setTileID(4, texture);
                        break;
                        }
            }
        }