Exemple #1
0
        public static void DrawZombie(bool walking, CollisionResolver resolver, float bodyRotation, RectangleF boundary, float rotLeg, Vector2 velocity)
        {
            Game1.SpriteBatchGlobal.Draw(Game1.zombie, boundary.Position + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(11, 31));

            Vector2 rightLegJoin = boundary.Origin + new Vector2(+12, +50);
            Vector2 leftLegJoin  = boundary.Origin + new Vector2(-12, +50);

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(10f, 5), effects: SpriteEffects.FlipHorizontally);
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(10f, 5), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(2f, 5));
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(2f, 5));
                }
            }
            else
            {
                if (resolver.TouchBottom == false && resolver.TouchTopMovable == false)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y)), origin: new Vector2(4.5f, 5));
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y)), origin: new Vector2(4.5f, 5));
                }
                else
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y + 8)), origin: new Vector2(4.5f, 5));
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y + 8)), origin: new Vector2(4.5f, 5));
                }
            }
        }
Exemple #2
0
 public Coin(Vector2 origin, Vector2 velocity, Pickups value)
 {
     Velocity   = velocity;
     Boundary   = new RectangleF(new Vector2(32), origin - new Vector2(16));
     _resolver  = new CollisionResolver(Globals.TileSize);
     _value     = value;
     _variation = (byte)Globals.GlobalRandom.Next(3);
 }
Exemple #3
0
 public Battery(Vector2 position) : base()
 {
     Boundary      = new RectangleF(new Vector2(36, 64), position);
     _resolver     = new CollisionResolver(Globals.TileSize);
     _weight       = 1f;
     _oldVelocity  = Velocity;
     _transparency = 0f;
 }
 public ParticleFlameDropBig(Vector2 position, Texture2D tex)
 {
     Boundary  = new RectangleF(new Vector2(16), position - new Vector2(8));
     _resolver = new CollisionResolver(Globals.TileSize);
     _alpha    = 1f;
     _resolver.move(ref _velocity, new Vector2(2f), Boundary, 0f, new Vector2(0f), new Vector2(0.01f), new Vector2(0.5f), Game1.mapLive.MapMovables, 0.00f);
     _velocity = new Vector2((float)Globals.GlobalRandom.NextDouble() - 0.5f, (float)Globals.GlobalRandom.NextDouble() - 0.5f);
     _tex      = tex;
 }
Exemple #5
0
 public ParticleSpark(Vector2 position)
 {
     Boundary  = new RectangleF(new Vector2(2), position - new Vector2(1));
     _resolver = new CollisionResolver(Globals.TileSize);
     _alpha    = 1f;
     _resolver.move(ref _velocity, new Vector2(2f), Boundary, 0f, new Vector2(0f), new Vector2(0.01f), new Vector2(0.5f), Game1.mapLive.MapMovables, 0.00f);
     _trail    = new RibbonTrail(Boundary.Origin, _velocity, 4, 2, 1, Game1.Textures["RibbonSpark"], null, Game1.Textures["RibbonSpark"]);
     _velocity = new Vector2((float)Globals.GlobalRandom.NextDouble() - 0.5f, (float)Globals.GlobalRandom.NextDouble() - 0.5f);
 }
 public ParticleBlackDrop(Vector2 origin, Vector2 velocity, Texture2D tex)
 {
     Boundary  = new RectangleF(new Vector2(0), origin - new Vector2(0));
     _resolver = new CollisionResolver(Globals.TileSize);
     _resolver.move(ref _velocity, new Vector2(2f), Boundary, 0f, new Vector2(0f), new Vector2(0.01f), new Vector2(0.5f), Game1.mapLive.MapMovables, 0.00f);
     _tex      = tex;
     _velocity = velocity + new Vector2((float)Globals.GlobalRandom.NextDouble() - 0.5f, (float)Globals.GlobalRandom.NextDouble() - 0.5f);
     _rotation = (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 8;
     _scale    = 0.5f;
 }
Exemple #7
0
 public Grenade(Vector2 position, Vector2 velocity, short damage)
 {
     Boundary     = new RectangleF(new Vector2(12 * 2, 14 * 2), position);
     Velocity     = velocity;
     _resolver    = new CollisionResolver(Globals.TileSize);
     _timer       = new Timer(1000, false);
     _bubbleTime  = new Timer(300, true);
     _damage      = damage;
     _oldVelocity = velocity;
 }
Exemple #8
0
 public PlayerAircraft(Vector2 position, Vector2 velocity, float health = 100f)
 {
     Boundary    = new RectangleF(AircraftModule.PlayerBoundarySize, position);
     _resolver   = new CollisionResolver(Globals.TileSize);
     _weight     = 1f;
     _time       = new Timer(100, true);
     _bubbleTime = new Timer(300, true);
     Friendly    = true;
     Velocity    = velocity;
     Health      = health;
 }
Exemple #9
0
        public PlayerWorld()
        {
            Speed    = new Vector2(0.2f);
            Velocity = Vector2.Zero;
            MaxSpeed = new Vector2(0.6f);

            Resolver       = new CollisionResolver(Globals.TileSize, Game1.mapLiveWorld);
            Time           = 0;
            ControlsActive = true;

            Boundary = new RectangleF(new Vector2(16, 32), Vector2.Zero);
        }
Exemple #10
0
 public Crate(Vector2 position, int tissue, int electro, int highTissue, int highElectro)
 {
     Boundary    = new RectangleF(new Vector2(64), position);
     _resolver   = new CollisionResolver(Globals.TileSize, Game1.mapLive);
     Tissue      = tissue;
     Electro     = electro;
     HighTissue  = highTissue;
     HighElectro = highElectro;
     _velocity   = new Vector2(0);
     _weight     = 2;
     Friendly    = false;
     Health      = 25;
 }
Exemple #11
0
 public PlayerMech(Vector2 position, mechFacingCabin face, Vector2 velocity, float health = 200f)
 {
     Boundary          = new RectangleF(MechModule.MechBoundarySize, position);
     _resolver         = new CollisionResolver(Globals.TileSize);
     _weight           = 1f;
     _time             = new Timer(100, true);
     _bubbleTime       = new Timer(300, true);
     Friendly          = true;
     Velocity          = velocity;
     WalkingVisible    = false;
     MechDirection     = mechFacingCabin.right;
     MechDirectionLegs = mechFacingLegs.left;
     _rotLeg           = 0;
     _walkSin          = (float)Math.Sin(0);
     Health            = health;
 }
Exemple #12
0
 public Zombie(Vector2 position) : base()
 {
     Velocity       = new Vector2(0.0f, 0.0f);
     _maxSpeed      = new Vector2(0.5f);
     Boundary       = new RectangleF(44, 124, position.X - 22, position.Y - 62);
     _resolver      = new CollisionResolver(Globals.TileSize);
     _weight        = 1f;
     Goes           = ZombieStates.stay;
     StunLeft       = new Timer(100);
     Health         = 100;
     StrikeTimer    = new Timer(1000, true);
     RotationLeg    = 0;
     RotationBody   = 0;
     Sense          = 1024;
     WalkingVisible = true;
     Friendly       = false;
 }
Exemple #13
0
        public Player()
        {
            InVehicle = false;
            Speed     = new Vector2(0.4f, 1.0f);
            Velocity  = Vector2.Zero;

            Resolver         = new CollisionResolver(Globals.TileSize);
            Tissue           = 10000;
            Electronics      = 10000;
            MaxHealth        = 100;
            PotentialHealth  = 100;
            PotentialShield  = 100;
            Health           = 100;
            maxShield        = 100;
            Shield           = 100;
            GrenadesCount    = 3000;
            ControlsActive   = true;
            Alive            = true;
            ShowDestination  = false;
            Carry            = null;
            Weapons          = new List <IWeapon>();
            MaxSpeed         = new Vector2(0.6f);
            WeaponsAvailable = true;
            VestOn           = true;
            GrenadeDmg       = 100;
            Items            = new List <PlayersItem>();

            Weapons.Add(new SimpleGun(1.0f, 0, 1000, this, 100, 10));
            Weapons.Add(new LightningGun(1.0f, 1000, 1000, this, 200, 20));
            Weapons.Add(new LaserGun(1.0f, 1000, 1000, this, 60, 30));
            Weapons.Add(new FlameThrower(1.0f, 1000, 1000, this, 100, 40));
            Weapons.Add(new RocketLauncher(1.6f, 100, 100, this, 100, 75));
            Weapons.Add(new EnergyLaucher(0.6f, 100, 100, this, 100, 125));
            Weapons.Add(new PlasmaGun(2.0f, 100, 100, this, 150, 60));

            CurrentWeapon        = 0;
            CurrentWeaponObject  = Weapons[CurrentWeapon];
            Boundary             = new RectangleF(BuddyModule.PlayerBoundarySize, new Vector2(256, 256));
            CurretnObjectControl = new BuddyModule(this, new Vector2(512, 256));
        }
Exemple #14
0
        public PlayerTurret(Vector2 position) : base()
        {
            Boundary    = new RectangleF(new Vector2(36, 64), position);
            _resolver   = new CollisionResolver(Globals.TileSize);
            _weight     = 1f;
            _time       = new Timer(100, true);
            _target     = null;
            _rotation   = (float)Math.PI / 2f;
            _ammo       = 0;
            _bubbleTime = new Timer(300, true);
            _kick       = 0;

            if (_target == null || LineSegmentF.Lenght(HeadPos, _target.Boundary.Origin) > 512 || CompareF.IntersectionLineWithOthers(new LineObject(Game1.PlayerInstance, new LineSegmentF(HeadPos, _target.Boundary.Origin)), Game1.mapLive.TileMapLines, Game1.mapLive) != null)
            {
                foreach (Inpc npc in Game1.mapLive.MapNpcs)
                {
                    if (npc.Friendly == false && !(npc is IUnkillable) && LineSegmentF.Lenght(HeadPos, npc.Boundary.Origin) <= 512 && CompareF.IntersectionLineWithOthers(new LineObject(Game1.PlayerInstance, new LineSegmentF(HeadPos, npc.Boundary.Origin)), Game1.mapLive.TileMapLines, Game1.mapLive) == null)
                    {
                        _target = npc;
                        break;
                    }
                }
            }
        }
Exemple #15
0
 public ParticleBubble(Vector2 origin)
 {
     Boundary  = new RectangleF(new Vector2(8, 8), origin - new Vector2(4));
     Velocity  = new Vector2((float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 4, Velocity.Y);
     _resolver = new CollisionResolver(Globals.TileSize);
 }
Exemple #16
0
        public static void DrawBuddyNormal(RectangleF boundary, float bodyRotation, float rotLeg, bool walking, bool vest, Vector2 velocity, CollisionResolver resolver)
        {
            Game1.SpriteBatchGlobal.Draw(Game1.Textures["playerNormal"], new Vector2((float)Math.Round(boundary.Position.X), (float)Math.Round(boundary.Position.Y)) + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(12 * 2, 31 * 2));

            if (vest == true)
            {
                Game1.EffectRotateNormals.Parameters["flip"].SetValue(new Vector2(1, 1));
                Game1.EffectRotateNormals.Parameters["angle"].SetValue(bodyRotation);
                Game1.EffectRotateNormals.CurrentTechnique.Passes[0].Apply();
                Game1.SpriteBatchGlobal.Draw(Game1.Textures["PlayerVestNormal"], new Vector2((float)Math.Round(boundary.Position.X), (float)Math.Round(boundary.Position.Y)) + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(12 * 2, 31 * 2));
                Effects.ResetEffect3D();
            }
        }
Exemple #17
0
        public static void DrawMech(RectangleF boundary, float rotLeg, bool walking, Vector2 velocity, CollisionResolver resolver, float walkSin, mechFacingLegs facingLegs, mechFacingCabin facingCabin)
        {
            Vector2 rightLegJoin = boundary.Origin + new Vector2(+12 + 16, +42);
            Vector2 leftLegJoin  = boundary.Origin + new Vector2(-12 - 16, +42);

            float jumpJoints = 4;

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2));
                }
            }
            else
            {
                if (resolver.TouchBottom == true || resolver.TouchTopMovable == true)
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], rightLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], leftLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
                else
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], rightLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], leftLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
            }

            if (facingCabin == mechFacingCabin.right)
            {
                Game1.SpriteBatchGlobal.Draw(texture: Game1.Textures["MechBody"], position: boundary.Position + new Vector2(0, (int)Math.Round((float)(Math.Sin(walkSin)))));
            }
            if (facingCabin == mechFacingCabin.left)
            {
                Game1.SpriteBatchGlobal.Draw(texture: Game1.Textures["MechBody"], position: boundary.Position + new Vector2(0, (int)Math.Round((float)Math.Sin(walkSin))), effects: SpriteEffects.FlipHorizontally);
            }

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2));
                }
            }
            else
            {
                if (resolver.TouchBottom == true || resolver.TouchTopMovable == true)
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], leftLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], rightLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
                else
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], leftLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], rightLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
            }
        }
Exemple #18
0
        public static void DrawBuddy(RectangleF boundary, float bodyRotation, float rotLeg, bool walking, bool vest, Vector2 velocity, CollisionResolver resolver)
        {
            Game1.SpriteBatchGlobal.Draw(Game1.playerTex, new Vector2((float)Math.Round(boundary.Position.X), (float)Math.Round(boundary.Position.Y)) + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(12 * 2, 31 * 2));

            if (vest == true)
            {
                Game1.SpriteBatchGlobal.Draw(Game1.Textures["PlayerVest"], new Vector2((float)Math.Round(boundary.Position.X), (float)Math.Round(boundary.Position.Y)) + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(12 * 2, 31 * 2));
            }

            Vector2 rightLegJoin = boundary.Origin + new Vector2(+12, +50);
            Vector2 leftLegJoin  = boundary.Origin + new Vector2(-12, +50);

            if (walking == true)
            {
                if (velocity.X - resolver.VelocityReceived.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(10f * 2, 5 * 2), effects: SpriteEffects.FlipHorizontally);
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(10f * 2, 5 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X - resolver.VelocityReceived.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(2 * 2f, 5 * 2));
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(2f * 2, 5 * 2));
                }
            }
            else
            {
                if (resolver.TouchTop == false && resolver.TouchTopMovable == false)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y)), origin: new Vector2(4.5f * 2, 5 * 2));
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y)), origin: new Vector2(4.5f * 2, 5 * 2));
                }
                else
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y + 8)), origin: new Vector2(4.5f * 2, 5 * 2));
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y + 8)), origin: new Vector2(4.5f * 2, 5 * 2));
                }
            }
        }