Esempio n. 1
0
 public Boolean CollisionMainAndEnemy(MainChar M, Enemy E)
 {
     Vector2 MPos = M.getPosition();
     Vector2 EPos = E.getPosition();
     if (MPos.X + (M.getTex().Width) > EPos.X && MPos.Y + (M.getTex().Height) > EPos.Y && MPos.X + (M.getTex().Width) < EPos.X + E.getTex().Width && MPos.Y + (M.getTex().Height) < EPos.Y + E.getTex().Height
         || MPos.X + (M.getTex().Width) > EPos.X && MPos.Y > EPos.Y && MPos.X + (M.getTex().Width) < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y + (M.getTex().Height) > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y + (M.getTex().Height) < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height)
     {
         return true;
     }
     return false;
 }
Esempio n. 2
0
 public void RemoveEnemy(Enemy e)
 {
     myEnemies.Remove(e);
 }
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);

            main = new MainChar(Content.Load<Texture2D>("testBox"), Content.Load<Texture2D>("daggerSprite"), Content.Load<Texture2D>("bolt2"), new Vector2(100f, 100f), new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, -.2f), new Vector2(.5f, 0), new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), 10f, this);
            enemy1 = new Enemy(Content.Load<Texture2D>("enemyBox"), new Vector2(700, 100), new Vector2(-.5f, 0), new Vector2(0, -.2f), new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), this);
            AddEnemy(enemy1);
            // TODO: use this.Content to load your game content here
        }
Esempio n. 4
0
 public void AddEnemy(Enemy e)
 {
     myEnemies.Add(e);
 }
Esempio n. 5
0
 public Boolean CollisionBoltAndEnemy(Bolt B, Enemy E)
 {
     Vector2 MPos = B.getPosition();
     Vector2 EPos = E.getPosition();
     if (MPos.X + (B.getBolt1().Width) > EPos.X && MPos.Y + (B.getBolt1().Height) > EPos.Y && MPos.X + (B.getBolt1().Width) < EPos.X + E.getTex().Width && MPos.Y + (B.getBolt1().Height) < EPos.Y + E.getTex().Height
         || MPos.X + (B.getBolt1().Width) > EPos.X && MPos.Y > EPos.Y && MPos.X + (B.getBolt1().Width) < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y + (B.getBolt1().Height) > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y + (B.getBolt1().Height) < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height)
     {
         return true;
     }
     return false;
 }