public void Update(GameTime gameTime, PlayerLifeForm player)
        {
            this.Position += Velocity;
            MoveTowardPlayer(gameTime, player);

            base.Update(gameTime);
        }
        public void TestNoCollision()
        {
            PlayerLifeForm player = new PlayerLifeForm()
            {
                BoundingBox = new Point(100, 100),
                Position = new Vector2(350, 350)
            };
            EnemyLifeForm enemy = new EnemyLifeForm(EvolutionStage.Default, EvolutionStage.Default, EvolutionStage.Default)
            {
                BoundingBox = new Point(100, 100),
                Position = new Vector2(500, 500)
            };

            Assert.IsFalse(CollisionHandler.ImageTouches(player, enemy));
        }
        public void CheckOverlapsImages()
        {
            PlayerLifeForm player = new PlayerLifeForm()
            {
                BoundingBox = new Point(100, 100),
                Position = new Vector2(350, 350)
            };
            EnemyLifeForm enemy = new EnemyLifeForm(EvolutionStage.Default, EvolutionStage.Default, EvolutionStage.Default)
            {
                BoundingBox = new Point(100, 100),
                Position = new Vector2(350, 350)
            };

            Vector2 otherIndex = CollisionHandler.PositionToPixelImage(new Vector2(100, 100), player.Position, enemy.Position);

            int xMin = (int)otherIndex.X;
            int yMin = (int)otherIndex.Y;

            Assert.IsTrue((xMin >= 0) && (xMin < 100) && (yMin >= 0) && (yMin < 100));
        }
        private void MoveTowardPlayer(GameTime gameTime, PlayerLifeForm player)
        {
            Vector2 differenceToPlayer = player.Position - Position;

            //first get direction only by normalizing the difference vector
            //getting only the direction, with a length of one
            differenceToPlayer.Normalize();

            //then move in that direction
            //based on how much time has passed
            Position += differenceToPlayer * (float)gameTime.ElapsedGameTime.TotalMilliseconds * 1f;

            Rotation = Vector2ToRadian(differenceToPlayer) + MathHelper.PiOver2;
        }