Beispiel #1
0
 private void MoveTowardsTarget()
 {
     if (Target.Location.X > Location.X)
     {
         // Right
         Physics.Impulse += new Vector(4, 0);
         Character.FaceDirection(Direction.Right);
     }
     else
     {
         // Left
         Physics.Impulse += new Vector(-4, 0);
         Character.FaceDirection(Direction.Left);
     }
 }
Beispiel #2
0
        public Enemy(Vector location, Direction initialDirection)
        {
            var sprite = Services.Sprites["player"];

            Physics   = Services.Game.Physics.CreateComponent(this);
            Character = new CharacterComponent(this, sprite, new Pistol()
            {
                InfiniteAmmo = true
            });

            Location = location;
            Size     = new Vector(sprite.Width, sprite.Height);

            Character.FaceDirection(initialDirection);
        }