Example #1
0
        protected override void LoadContent()
        {
            mouseState   = new MouseState();
            spriteBatch  = new SpriteBatch(GraphicsDevice);
            map          = new BackgroundMap(Content.Load <Texture2D>("0.png"), graphics);
            tileoffsetx  = 50;
            tileoffsety  = 50;
            tilesx       = 17;
            tilesy       = 17;
            completeList = Statics.convertTiles(tileoffsetx, tileoffsety, Tiles.construct(0), tilesx, tilesy, map);
            foreach (Tuple <ITile, Vector2> tile in completeList)
            {
                drawableTiles.Add(new DrawableTile(Content.Load <Texture2D>("border.png"), tile.Item2, tile.Item1));
                //Console.WriteLine(tile.Item1.type());
            }
            players.Add(new Character(0, drawableTiles, Content.Load <Texture2D>("char1.png"), tilesx, tilesy));
            players.Add(new Character(0, drawableTiles, Content.Load <Texture2D>("char2.png"), tilesx, tilesy));
            players.Add(new Character(0, drawableTiles, Content.Load <Texture2D>("char3.png"), tilesx, tilesy));
            players.Add(new Character(0, drawableTiles, Content.Load <Texture2D>("char4.png"), tilesx, tilesy));
            playerOnTurn = new Random().Next(0, (players.Count - 1));
            players[playerOnTurn].setSteps(0);

            for (int i = 0; i < players.Count; i++)
            {
                sideTrackers.Add(new SideTracker(Content, graphics, i, players));
            }
            rollButton        = new RollButton(graphics, Content.Load <Texture2D>("rollbutton.png"));
            diceImage         = new DiceRoll(Content, rollButton);
            currentPlayerIcon = new CurrentPlayerTurn(Content.Load <Texture2D>("char1.png"), rollButton);
        }
Example #2
0
        public static List <Tuple <ITile, Vector2> > convertTiles(int offsetx, int offsety, List <ITile> tilelist, int tilesx, int tilesy, BackgroundMap background)
        {
            List <Tuple <ITile, Vector2> > list = new List <Tuple <ITile, Vector2> >();
            var begin   = background.pos;
            int counter = 0;

            for (int y = 0; y < tilesy; y++)
            {
                for (int x = 0; x < tilesx; x++)
                {
                    if (x == 0)
                    {
                        if (y == 0)
                        {
                            list.Add(postuple(tilelist[counter], new Vector2(begin.X, begin.Y)));
                            counter++;
                        }
                        else
                        {
                            list.Add(postuple(tilelist[counter], new Vector2(begin.X, (begin.Y + (y * offsety)))));
                            counter++;
                        }
                    }
                    else
                    {
                        list.Add(postuple(tilelist[counter], new Vector2((begin.X + (x * offsetx)), (begin.Y + (y * offsety)))));
                        counter++;
                    }
                }
            }
            return(list);
        }