Example #1
0
        public void E_BeAttacked(ProtectSprite ProtectSprite, int CurrentHealth, FireSprite Fire)
        {
            if ((Fire.position.X + Fire.size.X) >= this.position.X)  // if the fire touch the enemy
            {
                //E_Shot = true;
                CurrentHealth -= ProtectSprite.P_GetPower();
            }

            if (CurrentHealth == 0)
            {
                E_Die = true;
            }
        }
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);



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

            //--Backgrounds--
            Background = Content.Load <Texture2D>("Background");
            mainFrame  = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

            //--Drawing Protect Sprite--
            P1 = new ProtectSprite(Content.Load <Texture2D>("Charizard"), new Vector2(200f, 200f), new Vector2(200f, 200f),
                                   graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            P2 = new ProtectSprite(Content.Load <Texture2D>("Blastoise"), new Vector2(200f, 400f), new Vector2(200f, 200f),
                                   graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            P3 = new ProtectSprite(Content.Load <Texture2D>("Bulbasaur"), new Vector2(200f, 600f), new Vector2(200f, 200f),
                                   graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            //--Drawing Enemy Sprite--
            E1 = new MediumEnemy(Content.Load <Texture2D>("Pidgey"), new Vector2(2000f, 200f), new Vector2(200f, 200f),
                                 graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            E2 = new MediumEnemy(Content.Load <Texture2D>("Ratata"), new Vector2(2000f, 400f), new Vector2(200f, 200f),
                                 graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            //--Drawing Fire--
            Fire1 = new FireSprite(Content.Load <Texture2D>("Fire"), new Vector2(400f, 200f), new Vector2(200f, 200f),
                                   graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            Fire2 = new FireSprite(Content.Load <Texture2D>("Fire"), new Vector2(400f, 400f), new Vector2(200f, 200f),
                                   graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            Fire3 = new FireSprite(Content.Load <Texture2D>("Fire"), new Vector2(400f, 600f), new Vector2(200f, 200f),
                                   graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            E1.Populate();
        }