Example #1
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);

            //load back
            backSprite = Content.Load<Texture2D> ("back");

            //font load
            font = Content.Load<SpriteFont> ("Arial");
            score = 0;
            scoresString = "Scores: ";
            //load map
            map1 = new Map (Content);
            //Creat new objects;
            player1 = new Tank (Content, "Tanks4", GameConstants.PLAYER1_X, winHeight,GameConstants.PLAYER1,map1);
            //create explosion
            spriteExp = Content.Load<Texture2D> ("explosion");

            //tanks.Add (new AI(Content,"MediumTanks4",GameConstants.LEFT_BOARDER,0,map1));
            mediumTanks.Add(new MediumTank(Content,"MediumTanks4",GameConstants.LEFT_BOARDER,0,map1));
            mediumTanks.Add(new MediumTank(Content,"MediumTanks4",GameConstants.CENTER_V,0,map1));
            armoredCars.Add(new ArmoredCar(Content,"MediumTanks4",GameConstants.RIGHT_BOARDER,0,map1));

            //add all in tanks
            tanks.AddRange (mediumTanks);
            tanks.AddRange (armoredCars);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TankWar.AI"/> class. With Map
 /// </summary>
 /// <param name="content">Content.</param>
 /// <param name="spriteName">Sprite name.</param>
 /// <param name="x">The x coordinate.</param>
 /// <param name="y">The y coordinate.</param>
 /// <param name="map">Map.</param>
 public AI(ContentManager content, String spriteName, int x, int y, Map map)
     : this(content,spriteName,x,y)
 {
     CubesInMap = map.Cubes;
 }
Example #3
0
 public ArmoredCar(ContentManager content, String spriteName, int x, int y, Map map)
     : base(content,spriteName,x,y, map)
 {
     this.MovingSpeed = GameConstants.TANK_MOVING_SPEED_ArmoredCar;
 }
Example #4
0
 public MediumTank(ContentManager content, String spriteName, int x, int y, Map map)
     : base(content,spriteName,x,y, map)
 {
 }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TankWar.Tank"/> class. with keys setting argument
        /// </summary>
        /// <param name="content">Content. to load content</param>
        /// <param name="spriteName">Sprite name. the content name loaded</param>
        /// <param name="x">The x coordinate.  -- the location of initializes</param></param>
        /// <param name="y">The y coordinate.  -- the location of initializes</param>
        public Tank( ContentManager content,string spriteName, int x, int y,  Keys[] keys, Map map)
            : this(content, spriteName, x, y)
        {
            //Set control keys
            keyUp = keys [0];
            keyRight = keys [1];
            keyDown = keys [2];
            keyLeft = keys [3];

            //set map
            this.CubesInMap = map.Cubes;
        }