/// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        /// <param name="args">args[0] = bool bigStar</param>
        /// <returns></returns>
        public Entity BuildEntity(Entity e, params object[] args)
        {
            e.Group = "Stars";
            e.Tag = "Star" + stars.ToString();
            ++stars;

            #region Sprite

            if (args.Length == 0)
            {
                Vector2 loc = new Vector2(rbitch.Next(-ScreenHelper.Viewport.Width / 2, ScreenHelper.Viewport.Width / 2), rbitch.Next(-ScreenHelper.Viewport.Width / 2, ScreenHelper.Viewport.Width / 2));

                Sprite s = new Sprite(spriteSheet, "redstar", 0f);

                s.FrameIndex = rbitch.Next(0, 3);
                s.Scale = (float)rbitch.NextDouble();
                e.AddComponent<Sprite>(s);
                Animation a = e.AddComponent<Animation>(new Animation(AnimationType.Bounce, 5));
                Particle p = e.AddComponent<Particle>(new Particle(e, ConvertUnits.ToSimUnits(loc), (float)Math.Atan2(loc.Y, loc.X), Vector2.Zero, (float)rbitch.Next(-3, 3) * 0.01f));
            }
            else
            {
                Vector2 loc = Vector2.Zero;

                Sprite s = new Sprite(spriteSheet, "nebula", 0f);

                e.AddComponent<Sprite>(s);

                Particle p = e.AddComponent<Particle>(new Particle(e, ConvertUnits.ToSimUnits(loc), 0f, Vector2.Zero, 0f));
            }

            #endregion Sprite

            return e;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        /// <param name="args">args[0] = Entity smasher, args[1] = Smasher loc</param>
        /// <returns></returns>
        public Entity BuildEntity(Entity e, params object[] args)
        {
            string spriteKey = "smasherball";

            #region Body

            Body bitch = e.AddComponent<Body>(new Body(_World, e));
            FixtureFactory.AttachEllipse(ConvertUnits.ToSimUnits(_SpriteSheet[spriteKey][0].Width / 2), ConvertUnits.ToSimUnits(_SpriteSheet[spriteKey][0].Height / 2), 20, 1f, bitch);
            Sprite s = new Sprite(_SpriteSheet, spriteKey, bitch, 1f, Color.White, 0.5f);
            e.AddComponent<Sprite>(s);

            bitch.BodyType = GameLibrary.Dependencies.Physics.Dynamics.BodyType.Dynamic;
            bitch.CollisionCategories = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat2 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat1;
            bitch.CollidesWith = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat6 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat1;
            bitch.OnCollision += LambdaComplex.BossCollision();

            ++bitch.Mass;

            Entity smasher = (args[0] as Entity);

            float dist = ConvertUnits.ToSimUnits(20f);
            Vector2 pos = smasher.GetComponent<Body>().Position + new Vector2(0, dist);
            bitch.Position = pos;

            #endregion Body

            #region Animation

            if (s.Source.Count() > 1)
                e.AddComponent<Animation>(new Animation(AnimationType.Bounce, 10));

            #endregion Animation

            #region Health

            e.AddComponent<Health>(new Health(1000000)).OnDeath +=
                ent =>
                {
                    Vector2 poss = e.GetComponent<ITransform>().Position;
                    _World.CreateEntityGroup("BigExplosion", "Explosions", poss, 10, e, e.GetComponent<IVelocity>().LinearVelocity);

                    int splodeSound = rbitch.Next(1, 5);
                    SoundManager.Play("Explosion" + splodeSound.ToString());
                };

            #endregion Health

            e.AddComponent<Origin>(new Origin(smasher));
            e.Group = "Enemies";
            e.Tag = "SmasherBall";
            return e;
        }
        public Entity BuildEntity(Entity e, params object[] args)
        {
            #region Body

            Body Body = e.AddComponent<Body>(new Body(_World, e));
            {
                FixtureFactory.AttachEllipse(//Add a basic bounding box (rectangle status)
                    ConvertUnits.ToSimUnits(_SpriteSheet.Animations["rotatinglightball"][0].Width * 2),
                    ConvertUnits.ToSimUnits(_SpriteSheet.Animations["rotatinglightball"][0].Height * 2),
                    5,
                    1,
                    Body);
                Body.Position = ConvertUnits.ToSimUnits((Vector2)args[0]);
                Body.BodyType = GameLibrary.Dependencies.Physics.Dynamics.BodyType.Dynamic;
                Body.CollisionCategories = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat3 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat16;
                Body.CollidesWith = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat2 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat4 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat5;
                Body.FixedRotation = false;

                Body.SleepingAllowed = false;
            }

            #endregion Body

            #region Sprite

            Sprite s = new Sprite(_SpriteSheet, "rotatinglightball", 0.4f);
            e.AddComponent<Sprite>(s);

            #endregion Sprite

            #region Animation

            e.AddComponent<Animation>(new Animation(AnimationType.Loop, 10));

            #endregion Animation

            #region Health

            e.AddComponent<Health>(new Health(1)).OnDeath += LambdaComplex.BigEnemyDeath(e, _World as SpaceWorld, 0);

            #endregion Health

            e.Group = "Structures";
            return e;
        }
        public override void Process(Entity e)
        {
            Body b = bodyMapper.Get(e);

            #region UserMovement
            if (WasMoving) //Stops movement
            {
                b.LinearDamping = (float)Math.Pow(_Velocity, _Velocity*4);
                WasMoving = false;
            }
            else
                b.LinearDamping = 0;

            Vector2 target = Vector2.Zero;
            if (Keyboard.GetState().IsKeyDown(Keys.D)){ //Right
                target += Vector2.UnitX;
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.A)){ //Left
                target += -Vector2.UnitX;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.S)){ //Down
                target += Vector2.UnitY;
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.W)){ //Up?
                target += -Vector2.UnitY;
            }

            if (target != Vector2.Zero) //If being moved by player
            {
                WasMoving = true;
                b.LinearDamping = _Velocity*2;
            }

            //Rotation
            if (b.LinearVelocity != Vector2.Zero)
                //b.Rotation = MathHelper.SmoothStep(b.Rotation, (float)Math.Atan2(b.LinearVelocity.Y, b.LinearVelocity.X) + (float)Math.PI/2f, 0.1f);
                b.Rotation = (float)Math.Atan2(b.LinearVelocity.Y, b.LinearVelocity.X) + (float)Math.PI / 2f;

            //update position
            b.ApplyLinearImpulse((target)*new Vector2(_Velocity));
            #endregion

            #region Animation
            if (target != Vector2.Zero && b.LinearVelocity.Length() != 0 && (int)(5/Math.Pow(b.LinearVelocity.Length(), 1 / 2)) != 0)
            { //if player is being moved.
                if (world.StepCount % (int)(5 / Math.Pow(b.LinearVelocity.Length(), 1 / 2)) == 0)
                {
                    AnimationHeight += 30;
                    AnimationHeight %= 90; //Max height on spritesheet.
                }
            }

            else
                AnimationHeight = 30;
            Sprite s = e.GetComponent<Sprite>();
            s = new Sprite(s.SpriteSheet.Texture, new Rectangle(15, AnimationHeight, 50, 30), s.Origin, s.Scale, s.Color, s.Layer);
            e.RemoveComponent(ComponentTypeManager.GetTypeFor<Sprite>());
            e.AddComponent<Sprite>(s);
            #endregion
        }
Beispiel #5
0
        public static Func<Body, bool> CreateBigGreen(Entity ent, float speed, float sideTime, float shootTime, float shotTime, float nonShoot, Sprite s, EntityWorld _World)
        {
            bool shot = false;
            float shotttt = 0f;
            float time = 0f;
            float ttttime = 0f;

            return
                (target) =>
                {
                    if (ttttime > sideTime)
                    {
                        ttttime = 0f;
                    }

                    Body b = ent.GetComponent<Body>();
                    float x = (float)(ConvertUnits.ToSimUnits(ScreenHelper.Viewport.Width / 2) * (Math.Cos(MathHelper.ToRadians(360 / sideTime) * ttttime)));

                    time += (float)_World.Delta / 1000;

                    if (shot)
                    {
                        if (shotttt > shotTime)
                        {
                            shotttt = 0f;

                            Vector2 offset = ConvertUnits.ToSimUnits(new Vector2(0, 25));

                            float rot = (float)Math.PI / 2;

                            Transform fireAt = new Transform(b.Position + offset, rot);

                            SoundManager.Play("Shot1");
                            _World.CreateEntity("BigGreenBullet", fireAt).Refresh();
                        }
                        if (time > shootTime)
                        {
                            time = 0f;
                            shot = false;
                        }
                    }
                    else
                    {
                        if (time > nonShoot)
                        {
                            time = 0f;
                            shot = true;
                        }
                    }

                    if (!ent.HasComponent<Slow>())
                    {
                        b.Position = new Vector2(x, b.Position.Y + speed * _World.Delta / 1000);
                        shotttt += (float)_World.Delta / 1000;
                        time += (float)_World.Delta / 1000;
                        ttttime += (float)_World.Delta / 1000;
                    }
                    else
                    {
                        handleSlow(ent, _World);
                    }
                    return false;
                };
        }
Beispiel #6
0
        public static Func<Body, bool> CreateWarMachine(Entity ent, float speed, Body bitch, float sideTime, float shootTime, Sprite s, EntityWorld _World)
        {
            float shotTime = 0f;
            float time = 0f;

            return
                (target) =>
                {
                    if (time > sideTime)
                        time = 0f;

                    Body b = ent.GetComponent<Body>();
                    float x = (float)(ConvertUnits.ToSimUnits(ScreenHelper.Viewport.Width / 2) * (Math.Cos(MathHelper.ToRadians(360 / sideTime) * time)));

                    if (shotTime > shootTime)
                    {
                        shotTime = 0f;
                        Vector2 velocity1 = new Vector2(0, 1);
                        velocity1 *= 8f;

                        SoundManager.Play("Shot2");
                        _World.CreateEntity("ExplosiveBullet", bitch.Position, velocity1, 1, "reddownmissile").Refresh();
                    }

                    if (!ent.HasComponent<Slow>())
                    {
                        b.Position = new Vector2(x, b.Position.Y + speed * _World.Delta / 1000);
                        shotTime += (float)_World.Delta / 1000;
                        time += (float)_World.Delta / 1000;
                    }
                    else
                    {
                        handleSlow(ent, _World);
                    }
                    return false;
                };
        }
Beispiel #7
0
        public static Func<Body, bool> CreateKillerGun(Entity ent, Entity origin, Vector2 offs, float shotTime, float shootTime, float nonShot, Sprite s, EntityWorld _World, bool shit)
        {
            bool shot = false;
            float shotttt = 0f;
            float time = 0f;

            return
                (target) =>
                {
                    Body b = ent.GetComponent<Body>();
                    Body b2 = origin.GetComponent<Body>();
                    b.RotateTo(Vector2.UnitX);
                    b.Position = b2.Position + offs;

                    if (shot)
                    {
                        if (shotttt > shotTime)
                        {
                            shotttt = 0f;

                            Vector2 offset = ConvertUnits.ToSimUnits(new Vector2(0, 50));

                            if (shit)
                                offset.X = ConvertUnits.ToSimUnits(6);
                            float rot = (float)Math.PI / 2;

                            Transform fireAt = new Transform(b.Position + offset, rot);

                            SoundManager.Play("Shot1");
                            _World.CreateEntity("KillerBullet", fireAt).Refresh();
                        }
                        if (time > shootTime)
                        {
                            time = 0f;
                            shot = false;
                        }
                    }
                    else
                    {
                        if (time > nonShot)
                        {
                            time = 0f;
                            shot = true;
                        }
                    }

                    if (!ent.HasComponent<Slow>())
                    {
                        shotttt += (float)_World.Delta / 1000;
                        time += (float)_World.Delta / 1000;
                    }

                    return false;
                };
        }
Beispiel #8
0
        public static Func<Body, bool> CreateFlamer(Entity ent, float speed, Body bitch, Sprite s, EntityWorld _World)
        {
            int times = 0;
            return
                (target) =>
                {
                    ++times;
                    Body b = ent.GetComponent<Body>();
                    Vector2 distance = target.Position - b.Position;

                    if (distance != Vector2.Zero)
                        distance.Normalize();
                    distance *= speed;

                    if (target != null && target.LinearVelocity != distance && !ent.HasComponent<Slow>())
                    {
                        b.LinearVelocity = distance;
                    }

                    if (times % 10 == 0)
                    {
                        int range = s.CurrentRectangle.Width / 2;
                        float posx = -range;
                        Vector2 pos1 = bitch.Position + ConvertUnits.ToSimUnits(new Vector2(posx, 0));
                        Vector2 pos2 = bitch.Position - ConvertUnits.ToSimUnits(new Vector2(posx, 0));
                        float x = posx / range;

                        float y = 1;

                        Vector2 velocity1 = new Vector2(x, y);
                        velocity1.Normalize();
                        velocity1 *= 7;
                        Vector2 velocity2 = new Vector2(-velocity1.X, velocity1.Y);

                        _World.CreateEntity("Fire", pos1, velocity1).Refresh();
                        _World.CreateEntity("Fire", pos2, velocity2).Refresh();
                    }
                    return false;
                };
        }
        public Entity BuildEntity(Entity e, params object[] args)
        {
            #region Body

            Body Body = e.AddComponent<Body>(new Body(_World, e));
            {
                FixtureFactory.AttachEllipse(//Add a basic bounding box (rectangle status)
                    ConvertUnits.ToSimUnits(_SpriteSheet.Animations["miniturret"][0].Width / 2f),
                    ConvertUnits.ToSimUnits(_SpriteSheet.Animations["miniturret"][0].Height / 2f),
                    5,
                    1,
                    Body);
                Body.Position = ConvertUnits.ToSimUnits((Vector2)args[0]);
                Body.BodyType = GameLibrary.Dependencies.Physics.Dynamics.BodyType.Dynamic;
                Body.CollisionCategories = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat1 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat16;
                Body.CollidesWith = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat2 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat5 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat16;
                Body.FixedRotation = false;
                Body.RotateTo((Body.Position));

                Body.SleepingAllowed = false;
            }

            #endregion Body

            #region Sprite

            Sprite s = new Sprite(_SpriteSheet, "miniturret", 0.4f);
            e.AddComponent<Sprite>(s);

            #endregion Sprite

            #region AI/GUN

            Inventory inv = e.AddComponent<Inventory>(new Inventory());

            AI ai = e.AddComponent<AI>(new AI(null,
                (target) => //AI FUNCTION
                {
                    Gun g = inv.CurrentGun;
                    g.BulletsToFire = true;

                    if (_DirectorSystem.SpawnState == SpawnState.Surge && g.Power == 1)
                    {
                        g.PowerUp((int)(DirectorSystem.StateDurations[(int)SpawnState.Surge] * 1000) - DirectorSystem.ElapsedSurge, 3);
                    }

                    /* Aiming *\
                     * X = v*t + x_o therefore
                     *  let X_aim = v_tar*t + x_tar
                     *            = v_bul*t + x_bul
                     *  therefore
                     *      0 = v_tar*t + x_tar - (v_bul*t + x_bul) =>
                     *  therefore
                     *      x_bul - x_tar = t(v_tar - v_bul)
                     *  so that
                     *      t = (x_bul - x_tar)/(v_tar - v_bul)
                     *  therefore X = (v_tar)*(x_bul - x_tar)/(v_tar - v_bul) + x_tar
                     */

                    //Vector2 zero = target.LinearVelocity*time - inv.CurrentGun.BulletVelocity*time + target.Position - Body.Position;
                    Vector2 time = (Body.Position - target.Position) /
                        (target.LinearVelocity - inv.CurrentGun.BulletVelocity);

                    Vector2 XFinal = (target.LinearVelocity) * time + target.Position;
                    Body.RotateTo(XFinal - Body.Position);

                    return true;

                    // Console.WriteLine((target.UserData as Entity).Tag + ": " + time);
                },
                "Enemies",
                ConvertUnits.ToSimUnits(500)));
            ai.Targeting = Targeting.Closest;

            #endregion AI/GUN

            #region Health

            e.AddComponent<Health>(new Health(5)).OnDeath +=
                ent =>
                {
                    Vector2 poss = e.GetComponent<ITransform>().Position;
                    _World.CreateEntity("Explosion", 0.5f, poss, ent, 2, Vector2.Zero).Refresh();

                    int splodeSound = 1;
                    SoundManager.Play("Explosion" + splodeSound.ToString());
                    Turrets.Remove(e);
                };

            #endregion Health

            #region Origin

            //e.AddComponent<Origin>(new Origin(args[1] as Entity));

            #endregion Origin

            e.Group = "Structures";

            Turrets.Add(e);
            return e;
        }
        public static Action<Entity> BossDeath(int type, SpaceWorld _World, Entity e, Sprite s, int tier, int points, string bossName)
        {
            return blarg =>
            {
                Vector2 poss = e.GetComponent<ITransform>().Position;

                if (type < 6)
                    _World.CreateEntityGroup("BigExplosion", "Explosions", poss, 15, blarg, e.GetComponent<IVelocity>().LinearVelocity);
                else
                {
                    _World.CreateEntityGroup("BiggerExplosion", "Explosions", poss, 7, blarg, e.GetComponent<IVelocity>().LinearVelocity);
                }

                int splodeSound = rbitch.Next(1, 5);
                SoundManager.Play("Explosion" + splodeSound.ToString());

                if (blarg is Entity && (blarg as Entity).Group != null && ((blarg as Entity).Group == "Players" || (blarg as Entity).Group == "Structures"))
                {
                    for (int m = 0; m < (_World as SpaceWorld).Players; ++m)
                    {
                        Entity ent = (_World as SpaceWorld).Player.ToArray()[m];
                        for (int cry = 0; cry < 5; ++cry)
                        {
                            Color crystalColor = DirectorSystem.CrystalColor();
                            int amount = 20 * tier;
                            Vector2 p = e.GetComponent<ITransform>().Position;
                            float range = (float)Math.Sqrt(s.CurrentRectangle.Width * s.CurrentRectangle.Height);
                            float x = 2 * (float)rbitch.NextDouble() - 1;
                            float y = 2 * (float)rbitch.NextDouble() - 1;
                            Vector2 offs = ConvertUnits.ToSimUnits(new Vector2(x, y) * range);
                            p += offs;

                            (_World as SpaceWorld).enemySpawnSystem.SpawnCrystal(p, crystalColor, amount, m);
                        }
                    }
                }

                if (blarg != null && blarg.Tag != "Base")
                {
                    ScoreSystem.GivePoints(points);
                    _World.CreateEntity("Score", points.ToString(), poss).Refresh();
                    BossScreen.BossKilled(bossName);
                }

                _World.enemySpawnSystem.ResetTags();
                _World.enemySpawnSystem.SpawnRate = 1;
            };
        }
        public Entity BuildEntity(Entity e, params object[] args)
        {
            int type = (int)args[0];

            #region Sprite

            string spriteKey = "";
            switch (type)
            {
                case 0:
                    spriteKey = "bluemissile";
                    break;

                case 1:
                    spriteKey = "graymissile";
                    break;

                case 2:
                    spriteKey = "swastika";
                    break;

                case 3:
                    spriteKey = "swastika2";
                    break;

                case 4:
                    spriteKey = "graye";
                    break;

                case 5:
                    spriteKey = "satellite";
                    break;
            }

            if (args.Length > 2)
                spriteKey = (string)args[2];

            #endregion Sprite

            #region Body

            Body bitch = e.AddComponent<Body>(new Body(_World, e));
            FixtureFactory.AttachEllipse(ConvertUnits.ToSimUnits(_SpriteSheet[spriteKey][0].Width / 2), ConvertUnits.ToSimUnits(_SpriteSheet[spriteKey][0].Height / 2), 5, 1f, bitch);
            Sprite s = new Sprite(_SpriteSheet, spriteKey, bitch, 1f, Color.White, 0.5f + (float)thugs / 1000000f);
            if (spriteKey.Contains("swastika"))
                s.Origin = new Vector2(s.CurrentRectangle.Width / 2, s.CurrentRectangle.Height / 2);
            e.AddComponent<Sprite>(s);
            bitch.BodyType = GameLibrary.Dependencies.Physics.Dynamics.BodyType.Dynamic;
            bitch.CollisionCategories = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat2;
            bitch.CollidesWith = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat1 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat3 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat6;
            bitch.OnCollision += LambdaComplex.BasicCollision();
            ++bitch.Mass;

            Vector2 pos = new Vector2((float)(rbitch.NextDouble() * 2) - 1, (float)(rbitch.NextDouble() * 2) - 1);
            pos.Normalize();
            pos *= MookTemplate.dist;
            pos = ConvertUnits.ToSimUnits(pos);
            bitch.Position = pos;
            bool rotateTo = true;
            if (spriteKey.Contains("swastika"))
            {
                e.GetComponent<Body>().AngularVelocity = (float)Math.PI * 4;
                rotateTo = false;
            }

            #endregion Body

            #region Animation

            if (s.Source.Count() > 1 && spriteKey != "satellite")
                e.AddComponent<Animation>(new Animation(AnimationType.Bounce, 10));

            #endregion Animation

            #region Crystal

            Color crystalColor = DirectorSystem.CrystalColor();
            int amount = 10;
            if (crystalColor == Color.Gray)
                amount = 2;
            e.AddComponent<Crystal>(new Crystal(crystalColor, amount));

            #endregion Crystal

            #region AI/Health

            AI a = new AI(args[1] as Body, AI.CreateFollow(e, 3, rotateTo), "Base");
            a.Recalculate = false;
            e.AddComponent<AI>(a);

            e.AddComponent<Health>(new Health(5)).OnDeath += LambdaComplex.BigEnemyDeath(e, _World as SpaceWorld, 25);

            #endregion AI/Health

            e.Group = "Enemies";
            return e;
        }
        public Entity BuildEntity(Entity e, params object[] args)
        {
            #region Origin

            //e.AddComponent<Origin>(new Origin(args[1] as Entity));

            #endregion Origin

            #region Body

            Body Body = e.AddComponent<Body>(new Body(_World, e));
            {
                FixtureFactory.AttachEllipse(//Add a basic bounding box (rectangle status)
                    ConvertUnits.ToSimUnits(_SpriteSheet.Animations["barrier"][0].Width / 2f),
                    ConvertUnits.ToSimUnits(_SpriteSheet.Animations["barrier"][0].Height / 2f),
                    5,
                    1,
                    Body);

                Body blarg = (args[1] as Entity).GetComponent<Body>();
                Vector2 dist = Body.Position - blarg.Position;
                dist.Normalize();
                dist *= distFromPlayer;

                Body.Position = ConvertUnits.ToSimUnits((Vector2)args[0] - dist);
                Body.BodyType = GameLibrary.Dependencies.Physics.Dynamics.BodyType.Dynamic;
                Body.CollisionCategories = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat1 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat16 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat15;
                Body.CollidesWith = GameLibrary.Dependencies.Physics.Dynamics.Category.Cat2 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat4 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat5 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat16 | GameLibrary.Dependencies.Physics.Dynamics.Category.Cat12;
                Body.FixedRotation = false;

                Body.RotateTo((Body.Position));

                Body.OnCollision += (f1, f2, c)
                    =>
                {
                    if ((f2.CollisionCategories & GameLibrary.Dependencies.Physics.Dynamics.Category.Cat12) != 0)
                        return false;
                    return true;
                };

                Body.SleepingAllowed = false;
            }

            #endregion Body

            #region Sprite

            Sprite s = new Sprite(_SpriteSheet, "barrier", 0.6f + (float)(barriers / 10000f));
            e.AddComponent<Sprite>(s);

            #endregion Sprite

            #region Health

            e.AddComponent<Health>(new Health(5)).OnDeath += LambdaComplex.SmallEnemyDeath(e, _World as SpaceWorld, 0);

            #endregion Health

            ++barriers;
            e.Group = "Structures";
            return e;
        }
 /// <summary>
 /// Creates a bullet template with a default sprite
 /// </summary>
 public BulletTemplate(Sprite defaultSprite)
     : this(defaultSprite, new Velocity(Vector2.One, 0.0f), new Bullet(1))
 {
 }
 /// <summary>
 /// Builds a bullet type using a default velocity and sprite
 /// </summary>
 /// <param name="defaultSprite">The default sprite that the sprite will use.</param>
 /// <param name="velocity">The default velocity that the sprite will use. (To make the bullet positioned relative to the gun, use 1 for all variables).</param>
 public BulletTemplate(Sprite defaultSprite, IVelocity defaultVelocity, Bullet defaultBullet)
 {
     this._DefaultVelocity = defaultVelocity;
     this._DefaultSprite = defaultSprite;
     this._DefaultBullet = defaultBullet;
 }