Esempio n. 1
0
        public Ghost(Texture2D texture) : base(texture)
        {
            // Stand
            CharacterSprite.CreateFrameList("stand", 120);
            CharacterSprite.AddCollider("stand", new Rectangle(3, 32, 25, 30));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 64),
                new Rectangle(32, 0, 32, 64),
                new Rectangle(64, 0, 32, 64),
                new Rectangle(96, 0, 32, 64)
            });

            // Jumping
            CharacterSprite.CreateFrameList("jumping", 120);
            CharacterSprite.AddCollider("jumping", new Rectangle(3, 32, 25, 30));
            CharacterSprite.AddFrames("jumping", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 64),
                new Rectangle(32, 0, 32, 64),
                new Rectangle(64, 0, 32, 64),
                new Rectangle(96, 0, 32, 64)
            });

            // Walking
            CharacterSprite.CreateFrameList("walking", 120);
            CharacterSprite.AddCollider("walking", new Rectangle(3, 32, 25, 30));
            CharacterSprite.AddFrames("walking", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 64),
                new Rectangle(32, 0, 32, 64),
                new Rectangle(64, 0, 32, 64),
                new Rectangle(96, 0, 32, 64)
            });
        }
Esempio n. 2
0
        public Bird(Texture2D texture) : base(texture)
        {
            // Stand
            CharacterSprite.CreateFrameList("stand", 200);
            CharacterSprite.AddCollider("stand", new Rectangle(15, 3, 36, 30));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 64, 32),
                new Rectangle(64, 0, 64, 32),
                new Rectangle(128, 0, 64, 32)
            });

            // Jumping
            CharacterSprite.CreateFrameList("jumping", 200);
            CharacterSprite.AddCollider("jumping", new Rectangle(15, 3, 36, 30));
            CharacterSprite.AddFrames("jumping", new List <Rectangle>()
            {
                new Rectangle(0, 0, 64, 32),
                new Rectangle(64, 0, 64, 32),
                new Rectangle(128, 0, 64, 32)
            });

            // Walking
            CharacterSprite.CreateFrameList("walking", 200);
            CharacterSprite.AddCollider("walking", new Rectangle(15, 3, 36, 30));
            CharacterSprite.AddFrames("walking", new List <Rectangle>()
            {
                new Rectangle(0, 0, 64, 32),
                new Rectangle(64, 0, 64, 32),
                new Rectangle(128, 0, 64, 32)
            });
        }
        //----------------------//------------------------//

        public Parrot(Texture2D texture) : base(texture)
        {
            _enemyType = EnemyType.Parrot;

            // Stand
            CharacterSprite.CreateFrameList("stand", 150);
            CharacterSprite.AddCollider("stand", new Rectangle(2, 8, 29, 17));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 32),
                new Rectangle(32, 0, 32, 32),
                new Rectangle(64, 0, 32, 32),
                new Rectangle(96, 0, 32, 32)
            }, new int[] { 0, 0, 0, 0 }, new int[] { 0, 0, 0, 0 });

            // Damage
            CharacterSprite.CreateFrameList("damage", 0);
            CharacterSprite.AddCollider("damage", new Rectangle(2, 8, 29, 17));
            CharacterSprite.AddFrames("damage", new List <Rectangle>()
            {
                new Rectangle(0, 32, 32, 32)
            }, new int[] { 0, 0, 0, 0 }, new int[] { 0, 0, 0, 0 });

            // Dying
            CharacterSprite.CreateFrameList("dying", 0);
            CharacterSprite.AddCollider("dying", new Rectangle(2, 8, 29, 17));
            CharacterSprite.AddFrames("dying", new List <Rectangle>()
            {
                new Rectangle(0, 32, 32, 32)
            }, new int[] { 0, 0, 0, 0 }, new int[] { 0, 0, 0, 0 });

            // Combat system init
            _hp           = 1;
            _damage       = 2;
            _flyDirection = Direction.Right;

            // SE init
            _hitSe = SoundManager.LoadSe("ParrotHit");

            IgnoreGravity = true;
        }
Esempio n. 4
0
        //----------------------//------------------------//

        public Mole(Texture2D texture) : base(texture)
        {
            _enemyType = EnemyType.Mole;

            // Digging
            CharacterSprite.CreateFrameList("stand", 150);
            CharacterSprite.AddCollider("stand", new Rectangle(5, -7, 22, 39));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 64, 32, 64),
                new Rectangle(32, 64, 32, 64),
                new Rectangle(64, 64, 32, 64),
                new Rectangle(96, 64, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Stuck
            CharacterSprite.CreateFrameList("stuck", 150);
            CharacterSprite.AddCollider("stuck", new Rectangle(5, -7, 22, 39));
            CharacterSprite.AddFrames("stuck", new List <Rectangle>()
            {
                new Rectangle(0, 64, 32, 64),
                new Rectangle(32, 64, 32, 64),
                new Rectangle(64, 64, 32, 64),
                new Rectangle(96, 64, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Jump Up
            CharacterSprite.CreateFrameList("jump_up", 0);
            CharacterSprite.AddCollider("jump_up", new Rectangle(2, 8, 29, 17));
            CharacterSprite.AddFrames("jump_up", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Jump Zero
            CharacterSprite.CreateFrameList("jump_zero", 0);
            CharacterSprite.AddCollider("jump_zero", new Rectangle(2, 8, 29, 17));
            CharacterSprite.AddFrames("jump_zero", new List <Rectangle>()
            {
                new Rectangle(32, 0, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Jump Down
            CharacterSprite.CreateFrameList("jump_down", 0);
            CharacterSprite.AddCollider("jump_down", new Rectangle(2, 8, 29, 17));
            CharacterSprite.AddFrames("jump_down", new List <Rectangle>()
            {
                new Rectangle(64, 0, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Dying
            CharacterSprite.CreateFrameList("dying", 0);
            CharacterSprite.AddCollider("dying", new Rectangle(2, 8, 29, 17));
            CharacterSprite.AddFrames("dying", new List <Rectangle>()
            {
                new Rectangle(96, 0, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Combat system init
            _hp              = 2;
            _damage          = 1;
            _viewRangeSize   = new Vector2(35, 100);
            _viewRangeOffset = new Vector2(0, -60);

            // Mechanics init
            _onHole       = true;
            _stuckOnGroud = false;
            _holePoint    = Vector2.Zero;

            // Texture init
            _holeTexture = new Texture2D(SceneManager.Instance.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _holeTexture.SetData <Color>(new Color[] { Color.Blue });

            CreateViewRange();
        }
Esempio n. 5
0
        //----------------------//------------------------//

        public Boss(Texture2D texture) : base(texture)
        {
            _enemyType = EnemyType.Boss;

            // Stand
            CharacterSprite.CreateFrameList("stand", 150);
            CharacterSprite.AddCollider("stand", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 96, 96),
                new Rectangle(96, 0, 96, 96),
                new Rectangle(192, 0, 96, 96),
                new Rectangle(288, 0, 96, 96)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Melee Attack
            CharacterSprite.CreateFrameList("melee_attack", 130, false);
            CharacterSprite.AddCollider("melee_attack", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("melee_attack", new List <Rectangle>()
            {
                new Rectangle(0, 320, 96, 94),
                new Rectangle(96, 320, 128, 94),
                new Rectangle(224, 320, 128, 94),
                new Rectangle(352, 320, 128, 94),
                new Rectangle(480, 320, 128, 94)
            }, new int[] { 0, -32, -32, -32, -32 }, new int[] { -29, -29, -29, -29, -29 });

            // Dash preparation
            CharacterSprite.CreateFrameList("dash_preparation", 120, false);
            CharacterSprite.AddCollider("dash_preparation", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("dash_preparation", new List <Rectangle>()
            {
                new Rectangle(0, 96, 96, 96),
                new Rectangle(96, 96, 96, 96),
            }, new int[] { 0, 0 }, new int[] { -32, -32 });

            // Dash attack
            CharacterSprite.CreateFrameList("dash_attack", 40);
            CharacterSprite.AddCollider("dash_attack", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("dash_attack", new List <Rectangle>()
            {
                new Rectangle(192, 96, 128, 96),
                new Rectangle(320, 96, 128, 96),
                new Rectangle(448, 96, 128, 96),
                new Rectangle(572, 96, 128, 96)
            }, new int[] { -16, -16, -16, -16 }, new int[] { -32, -32, -32, -32 });

            // Preparation of Cannons
            CharacterSprite.CreateFrameList("cannonballs", 120, false);
            CharacterSprite.AddCollider("cannonballs", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("cannonballs", new List <Rectangle>()
            {
                new Rectangle(0, 192, 96, 128),
                new Rectangle(96, 192, 96, 128),
                new Rectangle(192, 192, 96, 128),
                new Rectangle(288, 192, 96, 128)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -64, -64, -64, -64 });

            // Damage
            CharacterSprite.CreateFrameList("damage", 130);
            CharacterSprite.AddCollider("damage", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("damage", new List <Rectangle>()
            {
                new Rectangle(512, 0, 128, 96),
                new Rectangle(384, 0, 128, 96),
            }, new int[] { 0, 0 }, new int[] { -32, -32 });

            // Collapsing
            CharacterSprite.CreateFrameList("collapsing", 0);
            CharacterSprite.AddCollider("collapsing", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("collapsing", new List <Rectangle>()
            {
                new Rectangle(512, 0, 128, 96),
            }, new int[] { 0 }, new int[] { -32 });

            // Attacks setup
            _attackFrameList = new string[]
            {
                "melee_attack",
                "dash_attack",
                "cannonballs"
            };

            // Combat system init
            _hp               = 50;
            _viewRangeSize    = new Vector2(10, 74);
            _viewRangeOffset  = new Vector2(0, -5);
            _damage           = 2;
            _dashDelayMaxTick = 1000.0f;
            _dashDelayTick    = _dashDelayMaxTick;

            // Direction init
            _direction = CharacterSprite.Effect == SpriteEffects.None ? Direction.Left : Direction.Right;

            // Cannons init
            _cannons          = new List <GameCannon>();
            _cannonsToDestroy = new List <GameCannon>();

            // HP HUD init
            _hpBackRegion         = new Rectangle(0, 0, 344, 18);
            _hpFullRegion         = new Rectangle(344, 0, 12, 13);
            _hpHalfRegion         = new Rectangle(356, 0, 12, 13);
            _hpBackPosition       = new Vector2(18, 217);
            _hpSpritesPosition    = _hpBackPosition + new Vector2(10, 3);
            _hpSpritesheetTexture = ImageManager.loadMisc("BossHPSpritesheet");
            _hudAlpha             = 1.0f;

            // Collapse init
            _collapseExplosionsQueue = new List <CollapseExplosion>();
            _collapseExplosions      = new List <AnimatedSprite>();

            // Flash texture
            _flashTexture = new Texture2D(SceneManager.Instance.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _flashTexture.SetData(new Color[] { Color.White });

            // SEs load
            _explosionsSes = new SoundEffect[3];
            for (var i = 0; i < 3; i++)
            {
                _explosionsSes[i] = SoundManager.LoadSe(String.Format("Explosion{0}", i + 1));
            }

            CreateViewRange();
        }
        //----------------------//------------------------//

        public TurtleWheel(Texture2D texture) : base(texture)
        {
            _enemyType = EnemyType.TurtleWheel;

            // Stand
            CharacterSprite.CreateFrameList("stand", 150);
            CharacterSprite.AddCollider("stand", new Rectangle(2, 0, 28, 32));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 64),
                new Rectangle(32, 0, 32, 64),
                new Rectangle(64, 0, 32, 64),
                new Rectangle(96, 0, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Jumping
            CharacterSprite.CreateFrameList("jumping", 150);
            CharacterSprite.AddCollider("jumping", new Rectangle(2, 0, 28, 32));
            CharacterSprite.AddFrames("jumping", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 64),
                new Rectangle(32, 0, 32, 64),
                new Rectangle(64, 0, 32, 64),
                new Rectangle(96, 0, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Enter Wheel Mode
            CharacterSprite.CreateFrameList("enter_wheel_mode", 80, false);
            CharacterSprite.AddCollider("enter_wheel_mode", new Rectangle(2, 0, 28, 32));
            CharacterSprite.AddFrames("enter_wheel_mode", new List <Rectangle>()
            {
                new Rectangle(0, 96, 32, 64),
                new Rectangle(32, 96, 32, 64),
                new Rectangle(64, 96, 32, 64),
                new Rectangle(96, 96, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Wheel Mode
            CharacterSprite.CreateFrameList("wheel_mode", 150);
            CharacterSprite.AddCollider("wheel_mode", new Rectangle(2, 0, 28, 32));
            CharacterSprite.AddFrames("wheel_mode", new List <Rectangle>()
            {
                new Rectangle(0, 64, 32, 32),
                new Rectangle(32, 64, 32, 32),
                new Rectangle(64, 64, 32, 32),
                new Rectangle(96, 64, 32, 32)
            }, new int[] { 0, 0, 0, 0 }, new int[] { 0, 0, 0, 0 });

            // Confusion
            CharacterSprite.CreateFrameList("confusion", 150);
            CharacterSprite.AddCollider("confusion", new Rectangle(2, 0, 28, 32));
            CharacterSprite.AddFrames("confusion", new List <Rectangle>()
            {
                new Rectangle(0, 160, 32, 64),
                new Rectangle(32, 160, 32, 64),
                new Rectangle(64, 160, 32, 64),
                new Rectangle(96, 160, 32, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Damage
            CharacterSprite.CreateFrameList("damage", 0);
            CharacterSprite.AddCollider("damage", new Rectangle(2, 0, 28, 32));
            CharacterSprite.AddFrames("damage", new List <Rectangle>()
            {
                new Rectangle(0, 224, 32, 64),
            }, new int[] { 0 }, new int[] { -32 });

            // Dying
            CharacterSprite.CreateFrameList("dying", 0);
            CharacterSprite.AddCollider("dying", new Rectangle(2, 0, 28, 32));
            CharacterSprite.AddFrames("dying", new List <Rectangle>()
            {
                new Rectangle(0, 224, 32, 64),
            }, new int[] { 0 }, new int[] { -32 });

            // Attacks setup
            _attackFrameList = new string[]
            {
                "attack_roll"
            };

            // Combat system init
            _hp              = 3;
            _damage          = 3;
            _viewRangeSize   = new Vector2(150, 150);
            _viewRangeOffset = new Vector2(0, -100);
            _movementSide    = 1f;
            _acceleration    = 0f;

            // Mechanics init
            _enterWheelMode      = false;
            _wheelTick           = 0f;
            _wheelMode           = false;
            _hitGroundFromImpact = 0;
            _confusionTick       = 0f;

            // SEs init
            _deflectSe = SoundManager.LoadSe("Deflect");

            CreateViewRange();
        }
Esempio n. 7
0
        //----------------------//------------------------//

        public Boss(Texture2D texture) : base(texture)
        {
            _enemyType = EnemyType.Boss;

            // Stand
            CharacterSprite.CreateFrameList("stand", 150);
            CharacterSprite.AddCollider("stand", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 96, 96),
                new Rectangle(96, 0, 96, 96),
                new Rectangle(192, 0, 96, 96),
                new Rectangle(288, 0, 96, 96)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Melee Attack
            CharacterSprite.CreateFrameList("melee_attack", 120, false);
            CharacterSprite.AddCollider("melee_attack", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("melee_attack", new List <Rectangle>()
            {
                new Rectangle(0, 320, 96, 94),
                new Rectangle(96, 320, 128, 94),
                new Rectangle(224, 320, 128, 94),
                new Rectangle(352, 320, 128, 94),
                new Rectangle(480, 320, 128, 94)
            }, new int[] { 0, -32, -32, -32, -32 }, new int[] { -29, -29, -29, -29, -29 });

            // Dash preparation
            CharacterSprite.CreateFrameList("dash_preparation", 100, false);
            CharacterSprite.AddCollider("dash_preparation", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("dash_preparation", new List <Rectangle>()
            {
                new Rectangle(0, 96, 96, 96),
                new Rectangle(96, 96, 96, 96),
            }, new int[] { 0, 0 }, new int[] { -32, -32 });

            // Dash attack
            CharacterSprite.CreateFrameList("dash_attack", 40);
            CharacterSprite.AddCollider("dash_attack", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("dash_attack", new List <Rectangle>()
            {
                new Rectangle(192, 96, 128, 96),
                new Rectangle(320, 96, 128, 96),
                new Rectangle(448, 96, 128, 96),
                new Rectangle(572, 96, 128, 96)
            }, new int[] { -16, -16, -16, -16 }, new int[] { -32, -32, -32, -32 });

            // Preparation of Cannons
            CharacterSprite.CreateFrameList("cannonballs", 100, false);
            CharacterSprite.AddCollider("cannonballs", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("cannonballs", new List <Rectangle>()
            {
                new Rectangle(0, 192, 96, 128),
                new Rectangle(96, 192, 96, 128),
                new Rectangle(192, 192, 96, 128),
                new Rectangle(288, 192, 96, 128)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -64, -64, -64, -64 });

            // Damage
            CharacterSprite.CreateFrameList("damage", 130);
            CharacterSprite.AddCollider("damage", new Rectangle(15, 0, 70, 64));
            CharacterSprite.AddFrames("damage", new List <Rectangle>()
            {
                new Rectangle(512, 0, 128, 96),
                new Rectangle(384, 0, 128, 96),
            }, new int[] { 0, 0 }, new int[] { -32, -32 });

            // Attacks setup
            _attackFrameList = new string[]
            {
                "melee_attack",
                "dash_attack",
                "cannonballs"
            };

            // Combat system init
            _hp               = 50;
            _viewRangeSize    = new Vector2(10, 74);
            _viewRangeOffset  = new Vector2(0, -5);
            _damage           = 2;
            _dashDelayMaxTick = 1000.0f;
            _dashDelayTick    = _dashDelayMaxTick;

            // Direction init
            _direction = CharacterSprite.Effect == SpriteEffects.None ? Direction.Left : Direction.Right;

            // Projectiles init
            _projectiles = new List <GameProjectile>();

            // HP HUD init
            _hpBackRegion         = new Rectangle(0, 0, 344, 18);
            _hpFullRegion         = new Rectangle(344, 0, 12, 13);
            _hpHalfRegion         = new Rectangle(356, 0, 12, 13);
            _hpBackPosition       = new Vector2(18, 217);
            _hpSpritesPosition    = _hpBackPosition + new Vector2(10, 3);
            _hpSpritesheetTexture = ImageManager.loadMisc("BossHPSpritesheet");

            CreateViewRange();
        }
        //----------------------//------------------------//

        public SniperPig(Texture2D texture) : base(texture)
        {
            _enemyType = EnemyType.SniperPig;

            // Stand
            CharacterSprite.CreateFrameList("stand", 150);
            CharacterSprite.AddCollider("stand", new Rectangle(4, -2, 26, 34));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 64, 64),
                new Rectangle(64, 0, 64, 64),
                new Rectangle(128, 0, 64, 64),
                new Rectangle(192, 0, 64, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Alert
            CharacterSprite.CreateFrameList("alert", 120);
            CharacterSprite.AddCollider("alert", new Rectangle(4, -2, 26, 34));
            CharacterSprite.AddFrames("alert", new List <Rectangle>()
            {
                new Rectangle(0, 64, 64, 64),
                new Rectangle(64, 64, 64, 64),
                new Rectangle(128, 64, 64, 64),
                new Rectangle(192, 64, 64, 64)
            }, new int[] { 0, 0, 0, 0 }, new int[] { -32, -32, -32, -32 });

            // Attack shot
            CharacterSprite.CreateFrameList("attack_shot", 120);
            CharacterSprite.AddCollider("attack_shot", new Rectangle(4, -2, 26, 34));
            CharacterSprite.AddFrames("attack_shot", new List <Rectangle>()
            {
                new Rectangle(0, 128, 64, 64),
                new Rectangle(64, 128, 64, 64),
                new Rectangle(128, 128, 64, 64)
            }, new int[] { 0, 0, 0 }, new int[] { -32, -32, -32 });
            CharacterSprite.AddFramesToAttack("attack_shot", 1);

            // Jumping
            CharacterSprite.CreateFrameList("jumping", 0);
            CharacterSprite.AddCollider("jumping", new Rectangle(3, 0, 25, 32));
            CharacterSprite.AddFrames("jumping", new List <Rectangle>()
            {
                new Rectangle(0, 32, 32, 32)
            }, new int[] { 0 }, new int[] { 0 });

            // Damage
            CharacterSprite.CreateFrameList("damage", 0);
            CharacterSprite.AddCollider("damage", new Rectangle(4, -2, 26, 34));
            CharacterSprite.AddFrames("damage", new List <Rectangle>()
            {
                new Rectangle(0, 192, 64, 64)
            }, new int[] { 0 }, new int[] { -32 });

            // Dying
            CharacterSprite.CreateFrameList("dying", 0);
            CharacterSprite.AddCollider("dying", new Rectangle(4, -2, 26, 34));
            CharacterSprite.AddFrames("dying", new List <Rectangle>()
            {
                new Rectangle(0, 192, 64, 64)
            }, new int[] { 0 }, new int[] { -32 });

            // Attacks setup
            _attackFrameList = new string[]
            {
                "attack_shot"
            };

            // Combat system init
            _hp             = 2;
            _viewRangeSize  = new Vector2(300, 20);
            _alertAnimation = false;
            _shot           = false;
            _damage         = 2;

            // SE init
            _hitSe = SoundManager.LoadSe("PigHit");

            CreateViewRange();
        }
Esempio n. 9
0
        //----------------------//------------------------//

        public Player(Texture2D texture) : base(texture)
        {
            // Stand
            CharacterSprite.CreateFrameList("stand", 120);
            CharacterSprite.AddCollider("stand", new Rectangle(6, 2, 16, 30));
            CharacterSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(0, 0, 32, 32)
            });

            // Walking
            CharacterSprite.CreateFrameList("walking", 120);
            CharacterSprite.AddCollider("walking", new Rectangle(6, 2, 16, 30));
            CharacterSprite.AddFrames("walking", new List <Rectangle>()
            {
                new Rectangle(32, 0, 32, 32),
                new Rectangle(64, 0, 32, 32),
                new Rectangle(96, 0, 32, 32),
                new Rectangle(128, 0, 32, 32)
            });

            // Jumping up
            CharacterSprite.CreateFrameList("jumping", 60, false);
            CharacterSprite.AddCollider("jumping", new Rectangle(6, 2, 16, 30));
            CharacterSprite.AddFrames("jumping", new List <Rectangle>()
            {
                new Rectangle(0, 128, 32, 32),
                new Rectangle(32, 128, 32, 32)
            });

            // Jumping apex
            CharacterSprite.CreateFrameList("jumping_apex", 120, false);
            CharacterSprite.AddCollider("jumping_apex", new Rectangle(6, 2, 16, 30));
            CharacterSprite.AddFrames("jumping_apex", new List <Rectangle>()
            {
                new Rectangle(64, 128, 32, 32),
                new Rectangle(96, 128, 32, 32)
            });

            // Jumping falling
            CharacterSprite.CreateFrameList("jumping_impact", 30, false);
            CharacterSprite.AddCollider("jumping_impact", new Rectangle(6, 2, 16, 30));
            CharacterSprite.AddFrames("jumping_impact", new List <Rectangle>()
            {
                new Rectangle(128, 128, 32, 32),
                new Rectangle(160, 128, 32, 32)
            });

            // Recharging
            CharacterSprite.CreateFrameList("recharging", 120);
            CharacterSprite.AddCollider("recharging", new Rectangle(6, 2, 16, 30));
            CharacterSprite.AddFrames("recharging", new List <Rectangle>()
            {
                new Rectangle(0, 64, 64, 32),
                new Rectangle(64, 64, 32, 32),
                new Rectangle(96, 64, 64, 32),
                new Rectangle(160, 64, 32, 32)
            }, new int[] { 0, 0, -32, 0 }, new int[] { 0, 0, 0, 0 });

            // Shot
            CharacterSprite.CreateFrameList("attack_shot", 80, false);
            CharacterSprite.AddCollider("attack_shot", new Rectangle(6, 2, 16, 30));
            CharacterSprite.AddFramesToAttack("attack_shot", 0);
            CharacterSprite.AddFrames("attack_shot", new List <Rectangle>()
            {
                new Rectangle(0, 32, 64, 32),
                new Rectangle(64, 32, 64, 32),
                new Rectangle(128, 32, 32, 32),
                new Rectangle(160, 33, 32, 31)
            }, new int[] { 0, 0, 0, 0 }, new int[] { 0, 0, 0, 1 });

            SetupBottomSprite(texture);

            Position = new Vector2(32, 160);

            // Attacks setup
            _attackFrameList = new string[]
            {
                "attack_shot"
            };
            AttackCooldown = 300f;

            _ammo = MaxAmmo;

            // Particles init
            var particleTexture = new Texture2D(SceneManager.Instance.GraphicsDevice, 1, 1);

            particleTexture.SetData(new[] { Color.White });
            ParticlesInit(new TextureRegion2D(particleTexture));

            // SEs init
            var shotSe = SoundManager.LoadSe("Shot");

            _shotSei        = shotSe.CreateInstance();
            _shotSei.Volume = 0.7f;
            var footstepSe = SoundManager.LoadSe("Footstep");

            _footstepSei        = footstepSe.CreateInstance();
            _footstepSei.Volume = 0.8f;
            var vacuumSe = SoundManager.LoadSe("Vacuum");

            _vacuumSei        = vacuumSe.CreateInstance();
            _vacuumSei.Volume = 0.4f;
        }
Esempio n. 10
0
        private void SetupBottomSprite(Texture2D texture)
        {
            // Stand
            _bottomSprite = new CharacterSprite(texture);
            _bottomSprite.CreateFrameList("stand", 120);
            _bottomSprite.AddCollider("stand", new Rectangle(6, 2, 16, 30));
            _bottomSprite.AddFrames("stand", new List <Rectangle>()
            {
                new Rectangle(160, 0, 32, 32)
            });

            // Walking
            _bottomSprite.CreateFrameList("walking", 120);
            _bottomSprite.AddCollider("walking", new Rectangle(6, 2, 16, 30));
            _bottomSprite.AddFrames("walking", new List <Rectangle>()
            {
                new Rectangle(0, 160, 32, 32),
                new Rectangle(32, 160, 32, 32),
                new Rectangle(64, 160, 32, 32),
                new Rectangle(96, 160, 32, 32)
            });

            // Jumping up
            _bottomSprite.CreateFrameList("jumping", 60, false);
            _bottomSprite.AddCollider("jumping", new Rectangle(6, 2, 16, 30));
            _bottomSprite.AddFrames("jumping", new List <Rectangle>()
            {
                new Rectangle(0, 288, 32, 32),
                new Rectangle(32, 288, 32, 32)
            });

            // Jumping apex
            _bottomSprite.CreateFrameList("jumping_apex", 120, false);
            _bottomSprite.AddCollider("jumping_apex", new Rectangle(6, 2, 16, 30));
            _bottomSprite.AddFrames("jumping_apex", new List <Rectangle>()
            {
                new Rectangle(64, 288, 32, 32),
                new Rectangle(96, 289, 32, 31)
            }, new int[] { 0, 0 }, new int[] { 0, 1 });

            // Jumping falling
            _bottomSprite.CreateFrameList("jumping_impact", 30, false);
            _bottomSprite.AddCollider("jumping_impact", new Rectangle(6, 2, 16, 30));
            _bottomSprite.AddFrames("jumping_impact", new List <Rectangle>()
            {
                new Rectangle(128, 288, 32, 32),
                new Rectangle(160, 288, 32, 32)
            });

            // Recharging
            _bottomSprite.CreateFrameList("recharging", 120);
            _bottomSprite.AddCollider("recharging", new Rectangle(6, 2, 16, 30));
            _bottomSprite.AddFrames("recharging", new List <Rectangle>()
            {
                new Rectangle(0, 225, 32, 32),
                new Rectangle(32, 225, 32, 32),
                new Rectangle(64, 225, 32, 32),
                new Rectangle(96, 225, 32, 32)
            }, new int[] { 0, 0, 0, 0 }, new int[] { 1, 1, 1, 1 });

            // Shot
            _bottomSprite.CreateFrameList("attack_shot", 80, false);
            _bottomSprite.AddCollider("attack_shot", new Rectangle(6, 2, 16, 30));
            _bottomSprite.AddFrames("attack_shot", new List <Rectangle>()
            {
                new Rectangle(0, 193, 32, 31),
                new Rectangle(32, 193, 32, 31),
                new Rectangle(64, 193, 32, 31),
                new Rectangle(96, 193, 32, 31)
            }, new int[] { 0, 0, 0, 0 }, new int[] { 1, 1, 1, 1 });
        }