public ImpactEffect(Transform transform, SpriteSheet effectSheet, float effectLength)
 {
     m_impactSprite = new Sprite(Globals.TheGame, effectSheet, transform);
     m_impactSprite.Origin = new Microsoft.Xna.Framework.Vector2(0.1f, 0.9f);
     m_impactSprite.Alpha = 0.3f;
     m_spriteAnimation = new SpriteSheetAnimation(m_impactSprite, 0, effectSheet.AmountOfFrames - 1, effectLength, 1);
     m_spriteAnimation.Start();
 }
        public Shuriken()
            : base()
        {
            m_attack = new AttackComponent(1.0f, 0.1f);
            m_sprite = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("atk_shuriken", 1, 5), m_transform);
            m_sprite.Origin = new Vector2(0.5f, 0.0f);
            m_transform.Scale = new Vector2(3.0f, 3.0f);
            m_animation = new SpriteSheetAnimation(m_sprite, 0, 4, 0.1f, 1);
            m_pointCollider = new PointCollider(m_attack, Transform);

            World.UL_Global.Add(this, 0);
            World.DL_Foreground.Add(this, 0);
        }
Exemplo n.º 3
0
 public Title()
     : base()
 {
     m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("titre_anime", 4, 1), m_transform);
     m_animation = new SpriteSheetAnimation(m_sprite, 0, 3, 1.0f, -1);
     m_animation.Start();
     m_physics = new PhysicsComponent(Program.TheGame, m_transform);
     m_physics.GroundLevel = (int)TitleY;
     m_physics.Mass = 4;
     m_moveTo = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(TitleX, -100), 1);
     m_moveTo.Interpolator = new PSmoothstepInterpolation();
     m_moveTo.Timer.Interval = 0.4f;
     m_transform.Position = new Vector2(TitleX, -100);
 }
Exemplo n.º 4
0
        public Monster()
            : base()
        {
            m_spriteSheetNomNom = TextureLibrary.GetSpriteSheet("anim_monstre_miam", 8, 1);
            m_spriteSheetIdle = TextureLibrary.GetSpriteSheet("anim_monstre_neutre", 5, 1);
            m_sprite = new Sprite(Program.TheGame, m_spriteSheetIdle, m_transform);
            m_sprite.PixelCorrection = true;
            m_idle = new SpriteSheetAnimation(m_sprite, 0, 4, 3.0f, -1);
            m_openMouth = new SpriteSheetAnimation(m_sprite, 4, 6, 0.5f, 1);
            m_closeMouth = new Sequence(1);
            m_closeMouth.AddAction(new SpriteSheetAnimation(m_sprite, 6, 7, 0.45f, 1));
            m_closeMouth.AddAction(new MethodAction(Idle));
            m_actionManager = new SingleActionManager();
            m_transform.Position = new Vector2(MonsterPosX, MonsterPosY);

            m_breathing = new MoveToStaticAction(Program.TheGame, m_transform, m_transform.Position + new Vector2(0, 3), -1);
            m_breathing.Interpolator = new PSineInterpolation();
            m_breathing.Timer.Interval = 4.0f;
            m_breathing.Start();
        }
        public NewLevelButton()
            : base(new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("btn_newlevel", 1, 4), new Transform()))
        {
            m_animation = new SpriteSheetAnimation(m_buttonSprite, 0, 3, 0.5f, -1);
            m_popAction = new SingleActionManager();

            //m_in = new MoveToStaticAction(Globals.TheGame, m_transform, new Vector2(150, 300), false);
            //m_out = new MoveToStaticAction(Globals.TheGame, m_transform, new Vector2(150, 0), false);
            m_transform.Position = new Vector2(150, 300);

            _generation = new Counter(2, TextureLibrary.GetSpriteSheet("levelscore_vertical", 20, 1));
            _generation.Transform.ParentTransform = m_transform;

            _section = new Counter(1, TextureLibrary.GetSpriteSheet("levelscore_vertical", 20, 1));
            _section.Transform.ParentTransform = m_transform;

            _generation.Alpha = _section.Alpha = 1.0f;

            _generation.ScrollSpeed = _section.ScrollSpeed = 50;
        }
Exemplo n.º 6
0
        public Coin(COIN_TYPE type)
            : base()
        {
            _type = type;
            m_sprite = new Sprite(Globals.TheGame, CoinTextures[(int)type], Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_physics = new PhysicsComponent(Globals.TheGame, Transform);
            m_animation = new SpriteSheetAnimation(m_sprite, 0, 5, 0.1f, -1);
            m_animation.Start();
            m_physics.Throw((float)Globals.Random.NextDouble() * 25, Globals.Random.Next(-30, -10), 0);
            m_physics.Mass = 1.3f;
            m_physics.Restitution = 0.75f;
            //m_physics.GroundLevel = Globals.Random.Next(-8, 3);
            m_physics.GroundLevel = 0;
            m_circleCollider = new CircleCollider(this);

            World.UL_Global.Add(this, 0);
            World.DL_ItemDrops.Add(this, 1);

            //ADDTHISLATER
            //Backpacker.HitPlayerColliders.Add(m_circleCollider, PickUp);
        }
        static void InitialiseMovingOutAnimation()
        {
            #region Backpacker 0

            Sequence waveAnimation_0 = new Sequence();

            MoveToStaticAction walkMove_0 = new MoveToStaticAction(Globals.TheGame, Backpackers[0].Transform, new Vector2(MeetingPoint, 0), 1);
            walkMove_0.Timer.Interval = 0.5f;
            SpriteSheetAnimation walkAnim_0 = new SpriteSheetAnimation(Backpackers[0].Sprite, 0, 1, 0.1f, 5);
            waveAnimation_0.AddAction(new Concurrent(new PastaGameLibrary.Action[] { walkMove_0, walkAnim_0 }));
            waveAnimation_0.AddAction(new SpriteSheetAnimation(Backpackers[0].Sprite, 0, 0, 0.5f, 1));
            waveAnimation_0.AddAction(new SpriteSheetAnimation(Backpackers[0].Sprite, 2, 3, 0.2f, 4));
            waveAnimation_0.AddAction(new SpriteSheetAnimation(Backpackers[0].Sprite, 0, 0, 0.1f, 1));

            #endregion

            #region Backpacker 1

            Sequence waveAnimation_1 = new Sequence();

            MoveToStaticAction walkMove_1 = new MoveToStaticAction(Globals.TheGame, Backpackers[1].Transform, new Vector2(MeetingPoint - 40, 0), 1);
            walkMove_1.Timer.Interval = 0.5f;
            SpriteSheetAnimation walkAnim_1 = new SpriteSheetAnimation(Backpackers[1].Sprite, 0, 1, 0.1f, 5);
            waveAnimation_1.AddAction(new DelayAction(Globals.TheGame, 0.2f));
            waveAnimation_1.AddAction(new Concurrent(new PastaGameLibrary.Action[] { walkMove_1, walkAnim_1 }));
            waveAnimation_1.AddAction(new SpriteSheetAnimation(Backpackers[1].Sprite, 0, 0, 0.5f, 1));
            waveAnimation_1.AddAction(new SpriteSheetAnimation(Backpackers[1].Sprite, 2, 3, 0.1f, 5));
            waveAnimation_1.AddAction(new SpriteSheetAnimation(Backpackers[1].Sprite, 0, 0, 0.1f, 1));

            #endregion

            #region Backpacker 2

            Sequence waveAnimation_2 = new Sequence();

            MoveToStaticAction walkMove_2 = new MoveToStaticAction(Globals.TheGame, Backpackers[2].Transform, new Vector2(MeetingPoint - 80, 0), 1);
            walkMove_2.Timer.Interval = 0.5f;
            SpriteSheetAnimation walkAnim_2 = new SpriteSheetAnimation(Backpackers[2].Sprite, 0, 1, 0.1f, 5);
            waveAnimation_2.AddAction(new DelayAction(Globals.TheGame, 0.4f));
            waveAnimation_2.AddAction(new Concurrent(new PastaGameLibrary.Action[] { walkMove_2, walkAnim_2 }));
            waveAnimation_2.AddAction(new SpriteSheetAnimation(Backpackers[2].Sprite, 2, 3, 0.2f, 3));
            waveAnimation_2.AddAction(new SpriteSheetAnimation(Backpackers[2].Sprite, 0, 0, 0.1f, 1));

            #endregion

            s_movingOutAnimation = new Concurrent(new PastaGameLibrary.Action[] { waveAnimation_0, waveAnimation_1, waveAnimation_2 });
        }
        public FatZombie()
        {
            m_physics = new PhysicsComponent(Globals.TheGame, Transform);
            m_sprite = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_phat", 1, 12), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1);
            m_loot = Loot.GenerateLoot(12);

            ObjectState.BeginAction = delegate() { m_actionManager.StartNew(m_full); };
            ObjectState.StandbyAction = delegate() { m_actionManager.Stop(); m_sprite.SetFrame(0); };
            ObjectState.DestroyAction = delegate() { m_destructible.ClearHitEvents(); Backpacker.HitPlayerColliders.Remove(m_collider); };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); } );

            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, HP);

            m_impactBox = new AABB(new Transform(Transform, true), new Vector2(72, 67));
            m_impactBox.Transform.Position = new Vector2(13, -70);
            m_shurikenReceiver = new ShurikenReceiver(Transform, m_impactBox, 10);
            m_hitAnimation = new HitAnimation(World.baseEffect);
            m_measurer = new AABBMeasurer(new AABB(new Transform(Transform, true), new Vector2(50, 50)));

            m_full = new SpriteSheetAnimation(m_sprite, 0, 1, 0.7f, -1);
            m_noHead1 = new SpriteSheetAnimation(m_sprite, 2, 3, 0.7f, -1);
            m_noHead2 = new SpriteSheetAnimation(m_sprite, 4, 5, 0.7f, -1);
            m_noRightArm = new SpriteSheetAnimation(m_sprite, 6, 7, 0.7f, -1);
            m_noLeftArm = new SpriteSheetAnimation(m_sprite, 8, 9, 0.7f, -1);
            m_noShoulders = new SpriteSheetAnimation(m_sprite, 10, 11, 0.7f, -1);

            m_actionManager = new SingleActionManager();
            m_actionManager.StartNew(m_full);

            //_projections = new BodyPart[]
            //{
            //    null,
            //    new BodyPart(this, new Vector2(0, -55), "bp_fatshoulders"),
            //    new BodyPart(this, new Vector2(-15, -75), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-15, -75), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-30, -100), "bp_fathead2"),
            //    new BodyPart(this, new Vector2(-30, -115), "bp_fathead1"),
            //};

            //_destroyProjections = new BodyPart[] {
            //    new BodyPart(this, new Vector2(0, -45), "bp_fatupperb"),
            //    new BodyPart(this, new Vector2(0, -10), "bp_fatlowerb"),
            //};
            m_bodyParts = new ParticleSystem(Globals.TheGame, 7);

            m_head1 = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fathead1"), new Transform(Transform, true));
            m_head1.Transform.Position = new Vector2(-30, -110);
            m_bodyParts.AddParticle(m_head1);

            m_head2 = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fathead2"), new Transform(Transform, true));
            m_head2.Transform.Position = new Vector2(-30, -100);
            m_bodyParts.AddParticle(m_head2);

            m_shoulders = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatshoulders"), new Transform(Transform, true));
            m_shoulders.Transform.Position = new Vector2(0, -80);
            m_bodyParts.AddParticle(m_shoulders);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(-15, -75);
            m_bodyParts.AddParticle(m_armL);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-15, -75);
            m_bodyParts.AddParticle(m_armR);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(15, -65);
            m_bodyParts.AddParticle(m_upperB);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatlowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(15, -27);
            m_bodyParts.AddParticle(m_lowerB);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(7, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noHead1);
                m_head1.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(6, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noHead2);
                m_head2.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(5, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noRightArm);
                m_armR.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(4, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noLeftArm);
                m_armL.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noShoulders);
                m_shoulders.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 500, true);
                m_lowerB.Pop(-1.1f, 500, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }
        public BasicZombie()
            : base()
        {
            m_physics = new PhysicsComponent(Globals.TheGame, Transform);
            m_sprite = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_base", 1, 8), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_loot = Loot.GenerateLoot(4);

            ObjectState.BeginAction = delegate()
            {
                m_actionManager.StartNew(m_full);
            };
            ObjectState.StandbyAction = delegate()
            {
                m_actionManager.Stop();
                m_sprite.SetFrame(0);
            };
            ObjectState.DestroyAction = delegate()
            {
                m_destructible.ClearHitEvents();
                Backpacker.HitPlayerColliders.Remove(m_collider);
            };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); });
            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, HP);

            m_impactBox = new AABB(new Transform(Transform, true), new Vector2(22, 42));
            m_impactBox.Transform.Position = new Vector2(13, -44);
            m_measurer = new AABBMeasurer(m_impactBox);
            m_shurikenReceiver = new ShurikenReceiver(Transform, m_impactBox, 5);
            m_hitAnimation = new HitAnimation(World.baseEffect);

            m_full = new SpriteSheetAnimation(m_sprite, 0, 1, 0.5f, -1);
            m_noHead = new SpriteSheetAnimation(m_sprite, 2, 3, 0.5f, -1);
            m_noLeftArm = new SpriteSheetAnimation(m_sprite, 4, 5, 0.5f, -1);
            m_noRightArm = new SpriteSheetAnimation(m_sprite, 6, 7, 0.5f, -1);

            m_actionManager = new SingleActionManager();

            //Transform headTransform = new Transform(Transform, true
            //_projections = new BodyPart[] {
            //    null,
            //    new BodyPart(this, new Vector2(0, -65), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-10, -55), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(15, -75), "bp_basezombiehead"),
             // new BodyPart(this, new Vector2(10, -50), "bp_basezombieupperb"),
             //   new BodyPart(this, new Vector2(10, -10), "bp_basezombielowerb")
            //};

            ///
            /// Body Parts
            ///
            m_bodyParts = new ParticleSystem(Globals.TheGame, 5);

            m_head = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiehead"), new Transform(Transform, true));
            m_head.Transform.Position = new Vector2(5, -50);
            m_bodyParts.AddParticle(m_head);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(5, -30);
            m_bodyParts.AddParticle(m_armL);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-5, -30);
            m_bodyParts.AddParticle(m_armR);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombieupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(0, -30);
            m_bodyParts.AddParticle(m_upperB);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombielowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(0, -10);
            m_bodyParts.AddParticle(m_lowerB);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
                {
                    m_actionManager.StartNew(m_noHead);
                    m_head.Pop(-1.1f, 500, true);
                }));
            m_destructible.AddHealthEvent(2, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noLeftArm);
                m_armL.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(1, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noRightArm);
                m_armR.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 500, true);
                m_lowerB.Pop(-1.1f, 500, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }
 public MiniFire(Transform parent, Vector2 position)
 {
     m_transform = new Transform(parent, true);
     m_transform.Position = position;
     float scale = (float)Globals.Random.NextDouble() * 0.5f + 0.5f;
     m_transform.Scale = new Vector2(scale, scale);
     m_sprite = new Sprite(Globals.TheGame, MiniFireTexture, m_transform);
     m_animation = new SpriteSheetAnimation(m_sprite, 0, 3, 0.1f, -1);
 }