Esempio n. 1
0
        protected override void LoadContent()
        {
            // load textures
            backgroundTexture = Content.Load<Texture2D>("textures/others/grass");
            boxTexture = Content.Load<Texture2D>("textures/bz/boxwall");
            pyramidTexture = Content.Load<Texture2D>("textures/bz/pyramid");
            tankTexture = Content.Load<Texture2D>("textures/tank_white");

            // let's make some test boxes - THESE ARE OVERRIDEN IF A MAP IS LOADED 
            List<Sprite> tiled = new List<Sprite>();
            tiled.Add(new Box(this, boxTexture, new Vector2(-10, 10), new Vector2(10, 10), 0, Color.Blue));
            tiled.Add(new Box(this, boxTexture, new Vector2(10, 10), new Vector2(10, 10), 0, Color.Purple));
            tiled.Add(new Box(this, boxTexture, new Vector2(10, -10), new Vector2(10, 10), 0, Color.Green));
            tiled.Add(new Box(this, boxTexture, new Vector2(-10, -10), new Vector2(10, 10), (Single)Math.PI / 4, Color.Red));
            tiled.Add(new Box(this, boxTexture, new Vector2(0, 0), new Vector2(10, 10), 0, Color.Yellow));
            mapObjects.Add("tiled", tiled);

            List<Sprite> stretched = new List<Sprite>();
            mapObjects.Add("stretched", stretched);

            // load grid
            mapGrid = new Grid(new Vector2(WorldSize, WorldSize), MapObjects);

            // load scoreHUD font
            scoreHUD.LoadContent(Content);

            base.LoadContent();
        }
Esempio n. 2
0
        public void LoadMap(StreamReader sr)
        {
            // construct the StaticSprites from the stream
            mapObjects = ParseMapFile(sr);

            // add the boundaries
            AddMapBoundaries();

            // now we can make our grid, make it 10% larger than actual size to get any objects near the world edge
            mapGrid = new Grid(new Vector2(WorldSize, WorldSize) * 1.1f, MapObjects);
        }
Esempio n. 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            RectangleTexture = Content.Load<Texture2D>("Square");
            MyFont = Content.Load<SpriteFont>("MyFont");

            UpperLeft = new WorldObject(new Vector2(100, 150), new Vector2(75, 75), (Single)0.0f);
            UpperRight = new WorldObject(new Vector2(500, 100), new Vector2(75, 75), (Single)0.0f);
            LowerLeft = new WorldObject(new Vector2(200, 450), new Vector2(100, 100), (Single)0.0f);
            LowerRight = new WorldObject(new Vector2(550, 480), new Vector2(100, 100), (Single)0.0f);
            mouse = new WorldObject(new Vector2(100, 590), new Vector2(50, 50), (Single)Math.PI / 4);

            allObjects.Add(UpperLeft);
            allObjects.Add(UpperRight);
            allObjects.Add(LowerLeft);
            allObjects.Add(LowerRight);

            //Without a camera only the first quadrant will be visible - so the world is 4x(800,600)
            grid = new Grid(new Vector2(1600, 1200), gridSize, allObjects);
            System.Diagnostics.Debug.WriteLine("The Grid is constructed");
            System.Diagnostics.Debug.WriteLine("LoadContent is finshed");
        }