Example #1
0
        public bool CheckCollision2(Tripod other)
        {
            Rectangle myRect = new Rectangle(Convert.ToInt32(X), Convert.ToInt32(Y),
                                             Convert.ToInt32(Height), Convert.ToInt32(Width));
            Rectangle otherRect =
                new Rectangle(Convert.ToInt32(other.X), Convert.ToInt32(other.Y),
                              Convert.ToInt32(other.Width), Convert.ToInt32(other.Height));

            return(myRect.Intersects(otherRect));
        }
Example #2
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);

            enemies2 = new List <Tripod>();
            enemies  = new List <Mine>();
            Random    random    = new Random();
            Texture2D tmpSprite =
                Content.Load <Texture2D>("mine");
            int posX = 0;
            int posY = 0;

            for (int i = 0; i < 100; i++)
            {
                if (posX < 1350)
                {
                    posX += 150;
                }
                else
                {
                    posX  = 75;
                    posY += 150;
                }
                Mine temp = new Mine(tmpSprite, posX, posY, 6f, 0.3f);
                enemies.Add(temp);
            }
            tmpSprite = Content.Load <Texture2D>("tripod");
            int posX1 = 75;
            int posY1 = 75;

            for (int i = 0; i < 100; i++)
            {
                if (posX1 < 1350)
                {
                    posX1 += 150;
                }
                else
                {
                    posX1  = 75;
                    posY1 += 150;
                }

                Tripod temp = new Tripod(tmpSprite, posX1, posY1, 0f, 3f);

                // Lägg till i listan
                enemies2.Add(temp);
            }
            Arial = Content.Load <SpriteFont>("Fonts/Arial");



            // TODO: use this.Content to load your game content here
        }