public PhysicsParticle(SpriteSheet spriteSheet, Vector2 startPosition, float fx, float fy)
 {
     m_transform = new Transform();
     m_transform.Position = startPosition;
     m_physics = new PhysicsComponent(Program.TheGame, m_transform);
     m_sprite = new Sprite(Program.TheGame, spriteSheet, m_transform);
     m_sprite.Colour = new Vector4(24.0f / 255, 52.0f / 255, 66.0f/ 255, 1);
     m_physics.Throw(fx, fy, 0);
 }
Exemplo n.º 2
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.º 3
0
        public Explosion(Vector2 initialPosition, Player player)
        {
            //m_transform.ParentTransform = player.Transform;
            m_playerInstance = player;
            m_transform.Position = player.Transform.PositionGlobal;
            m_sprite = new Sprite(Program.TheGame, particleTextures[Program.Random.Next(0, 4)], m_transform);
            m_physics = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = 2 + (float)Program.Random.NextDouble();
            m_physics.GroundLevel = Program.Random.Next(0, 10);

            float fx = 1 + (float)Program.Random.NextDouble() * 2;
            float fy = -1 - (float)Program.Random.NextDouble() * 2;
            if (player.SpriteTransform.PosX < 0)
                m_physics.Throw(fx, fy, 1.0f);
            else
                m_physics.Throw(-fx, fy, 1.0f);
        }
Exemplo n.º 4
0
        public Explosion(Vector2 initialPosition, Player player)
        {
            //m_transform.ParentTransform = player.Transform;
            m_playerInstance      = player;
            m_transform.Position  = player.Transform.PositionGlobal;
            m_sprite              = new Sprite(Program.TheGame, particleTextures[Program.Random.Next(0, 4)], m_transform);
            m_physics             = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass        = 2 + (float)Program.Random.NextDouble();
            m_physics.GroundLevel = Program.Random.Next(0, 10);

            float fx = 1 + (float)Program.Random.NextDouble() * 2;
            float fy = -1 - (float)Program.Random.NextDouble() * 2;

            if (player.SpriteTransform.PosX < 0)
            {
                m_physics.Throw(fx, fy, 1.0f);
            }
            else
            {
                m_physics.Throw(-fx, fy, 1.0f);
            }
        }
Exemplo n.º 5
0
        public CutscenePlayer()
            : base()
        {
            m_ascendSound = SoundEffectLibrary.Get("ascend").CreateInstance();
            m_cloud       = new Prop("cloud");
            m_sword       = new Prop("sword");

            m_shlingSprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("shling"), new Transform(m_transform, true));

            m_sprite                 = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("player_cutscene", 1, 4), new Transform(m_transform, true));
            m_sprite.Origin          = new Vector2(0.5f, 0.5f);
            m_sprite.PixelCorrection = false;

            m_moveToCrowd = new MoveToTransform(Program.TheGame, m_transform, null, null, 1);
            m_moveToCrowd.Timer.Interval = 0.1f;
            MoveToStaticAction carryMovement = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(0, CarryHeight - 5), 1);

            carryMovement.Interpolator   = new PBounceInterpolation(1.0f);
            carryMovement.StartPosition  = new Vector2(0, CarryHeight);
            carryMovement.Timer.Interval = 0.2f;
            MethodAction action = new MethodAction(delegate() { carryMovement.StartPosition = new Vector2(0, CarryHeight); });

            Sequence bounceAnimation = new Sequence(-1);

            bounceAnimation.AddAction(carryMovement);
            bounceAnimation.AddAction(action);

            m_carryAnimation = new Sequence(1);
            m_carryAnimation.AddAction(m_moveToCrowd);
            m_carryAnimation.AddAction(bounceAnimation);


            //Sword movement
            Transform start = new Transform(m_transform, true);
            Transform end   = new Transform(m_transform, true);

            m_swordMovement = new MoveToTransform(Program.TheGame, m_sword.Transform, start, end, 1);
            end.PosX        = SwordOffsetToPlayerX;
            end.PosY        = SwordOffsetToPlayerY;
            m_swordDelay    = new DelayAction(Program.TheGame, AscendDuration * SwordStartTimeRatio);

            //Cloud movement
            m_cloudMovement = new MoveToStaticAction(Program.TheGame, m_cloud.Transform, new Vector2(CloudOffsetToPlayerX, CloudOffsetToPlayerY), 1);
            m_cloudMovement.StartPosition = new Vector2(CloudStartX, 0);
            m_cloudMovement.Interpolator  = new PSquareInterpolation(0.25f);

            //Delay of the ascend, then sword/cloud movement
            Sequence swordAndCloudMovement = new Sequence(1);

            swordAndCloudMovement.AddAction(m_swordDelay);
            swordAndCloudMovement.AddAction(new Concurrent(new PastaGameLibrary.Action[] { m_swordMovement, m_cloudMovement }));

            m_ascendMovement = new MoveToTransform(Program.TheGame, m_transform, new Transform(), new Transform(), 1);
            m_ascendMovement.Interpolator = new PSquareInterpolation(0.5f);

            MethodAction showPlayer = new MethodAction(delegate()
            {
                m_sprite.Transform.PosY -= 1;
                Game1.player.ShowPlayer();
                isVisible         = false;
                m_cloud.IsVisible = false;
                m_sword.IsVisible = false;
            });

            //Shling!
            ScaleToAction shlingScale = new ScaleToAction(Program.TheGame, m_shlingSprite.Transform, new Vector2(ShlingScale, ShlingScale), 1);

            shlingScale.Timer.Interval = ShlingTime;
            shlingScale.StartScale     = Vector2.Zero;
            shlingScale.Interpolator   = new PSquareInterpolation(2);

            RotateToStaticAction shlingRotate = new RotateToStaticAction(Program.TheGame, m_shlingSprite.Transform, ShlingSpin, 1);

            shlingRotate.Timer.Interval = ShlingTime;
            m_shling = new Concurrent(new PastaGameLibrary.Action[] { shlingScale, shlingRotate });

            Sequence readyAnim = new Sequence(1);

            readyAnim.AddAction(new DelayAction(Program.TheGame, 0.5f));
            readyAnim.AddAction(new MethodAction(delegate() {
                Cutscenes.GetReady();
                SoundEffectLibrary.Get("sword_slash").Play();
            }));

            Concurrent shlingReady = new Concurrent(new PastaGameLibrary.Action[] {
                m_shling,
                readyAnim,
            });

            m_ascend = new Sequence(1);
            m_ascend.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime));
            m_ascend.AddAction(new MethodAction(delegate() { m_ascendSound.Play(); }));
            Concurrent ascendAndSword = new Concurrent(new PastaGameLibrary.Action[] { m_ascendMovement, swordAndCloudMovement });

            m_ascend.AddAction(ascendAndSword);
            m_ascend.AddAction(showPlayer);
            m_ascend.AddAction(shlingReady);

            m_physics      = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = 3.0f;

            m_jumpFromTotem           = new Sequence(1);
            m_decelerate              = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1);
            m_decelerate.Interpolator = new PSquareInterpolation(0.5f);
            m_jumpFromTotem.AddAction(m_decelerate);
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.2f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                m_physics.OnBounce = null;
                m_physics.Throw(1.0f, -2.0f, 0);
                Game1.CurrentMusic.StopDynamicMusic();
                SoundEffectLibrary.Get("sword_slash").Play();
            }));
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.75f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                Game1.SetupNextRound();
                if (Game1.CurrentTotem == null)
                {
                    Cutscenes.GoToCliff();
                }
                else
                {
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                }
            }));
            m_actionManager = new SingleActionManager();

            m_hitSpikes = new Sequence(1);

            m_moveToCrashingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), new Transform(), 1);
            m_moveToCrashingPlayer.Timer.Interval = 0.2f;

            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_hitSpikes.AddAction(m_moveToCrashingPlayer);
            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_hitSpikes.AddAction(new MethodAction(delegate() {
                if (Game1.CurrentTotem == null)
                {
                    Cutscenes.GoToCliff();
                }
                else
                {
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                }
                m_sprite.SetFrame(0);
                m_physics.OnBounce = null;
                m_physics.Throw(0, -3, 0);
                m_transform.PosY = m_physics.GroundLevel;
            }));

            m_auraParticles = new ParticleSystem(Program.TheGame, 100);
            m_soulParticles = new ParticleSystem(Program.TheGame, 500);

            m_levitate       = new Sequence(1);
            m_moveToCliffTip = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(Cutscenes.InitialCharacterPosition + 10, -8), 1);
            m_moveToCliffTip.Interpolator   = new PSmoothstepInterpolation();
            m_moveToCliffTip.Timer.Interval = 1.0f;
            m_levitate.AddAction(m_moveToCliffTip);
            m_levitate.AddAction(new MethodAction(delegate() { m_generateSouls = true; }));

            m_particleGenerator                    = new ParticleGenerator <GlitterParticle>(Program.TheGame, m_auraParticles);
            m_particleGenerator.Automatic          = true;
            m_particleGenerator.GenerationInterval = 0.01f;
            m_soulParticleGenerator                = new ParticleGenerator <SoulParticle>(Program.TheGame, m_soulParticles);

            m_jumpInMouth = new Sequence(1);
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { m_generateSouls = false; }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { JumpInMonsterMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.25f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.monster.CloseMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 2.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.crowd.PushNewGuy(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.StartMainMenu(); }));
        }
Exemplo n.º 6
0
 public SoulParticle()
 {
     m_transform = new Transform();
     m_transform.Position = Cutscenes.cutscenePlayer.Transform.Position;
     m_physics = new PhysicsComponent(Program.TheGame, m_transform);
     m_sprite = new Sprite(Program.TheGame, Cutscenes.soulTexture, m_transform);
     m_physics.Throw((float)Program.Random.NextDouble() * 0.5f + 0.6f, (float)Program.Random.NextDouble() * -2.0f, 0);
     m_physics.GroundLevel = 55;
 }
Exemplo n.º 7
0
 public Prop(string textureName)
     : base()
 {
     m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet(textureName), new Transform(m_transform, true));
     m_sprite.Transform.Direction = Math.PI * 10;
     Physics = new PhysicsComponent(Program.TheGame, m_sprite.Transform);
     Physics.OnBounce = delegate() { IsVisible = false; };
 }
Exemplo n.º 8
0
        public CutscenePlayer()
            : base()
        {
            m_ascendSound = SoundEffectLibrary.Get("ascend").CreateInstance();
            m_cloud = new Prop("cloud");
            m_sword = new Prop("sword");

            m_shlingSprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("shling"), new Transform(m_transform, true));

            m_sprite = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("player_cutscene", 1, 4), new Transform(m_transform, true));
            m_sprite.Origin = new Vector2(0.5f, 0.5f);
            m_sprite.PixelCorrection = false;

            m_moveToCrowd = new MoveToTransform(Program.TheGame, m_transform, null, null, 1);
            m_moveToCrowd.Timer.Interval = 0.1f;
            MoveToStaticAction carryMovement = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(0, CarryHeight - 5), 1);
            carryMovement.Interpolator = new PBounceInterpolation(1.0f);
            carryMovement.StartPosition = new Vector2(0, CarryHeight);
            carryMovement.Timer.Interval = 0.2f;
            MethodAction action = new MethodAction(delegate() { carryMovement.StartPosition = new Vector2(0, CarryHeight); });

            Sequence bounceAnimation = new Sequence(-1);
            bounceAnimation.AddAction(carryMovement);
            bounceAnimation.AddAction(action);

            m_carryAnimation = new Sequence(1);
            m_carryAnimation.AddAction(m_moveToCrowd);
            m_carryAnimation.AddAction(bounceAnimation);

            //Sword movement
            Transform start = new Transform(m_transform, true);
            Transform end = new Transform(m_transform, true);
            m_swordMovement = new MoveToTransform(Program.TheGame, m_sword.Transform, start, end, 1);
            end.PosX = SwordOffsetToPlayerX;
            end.PosY = SwordOffsetToPlayerY;
            m_swordDelay = new DelayAction(Program.TheGame, AscendDuration * SwordStartTimeRatio);

            //Cloud movement
            m_cloudMovement = new MoveToStaticAction(Program.TheGame, m_cloud.Transform, new Vector2(CloudOffsetToPlayerX, CloudOffsetToPlayerY), 1);
            m_cloudMovement.StartPosition = new Vector2(CloudStartX, 0);
            m_cloudMovement.Interpolator = new PSquareInterpolation(0.25f);

            //Delay of the ascend, then sword/cloud movement
            Sequence swordAndCloudMovement = new Sequence(1);
            swordAndCloudMovement.AddAction(m_swordDelay);
            swordAndCloudMovement.AddAction(new Concurrent(new PastaGameLibrary.Action[] { m_swordMovement, m_cloudMovement }));

            m_ascendMovement = new MoveToTransform(Program.TheGame, m_transform, new Transform(), new Transform(), 1);
            m_ascendMovement.Interpolator = new PSquareInterpolation(0.5f);

            MethodAction showPlayer = new MethodAction(delegate()
            {
                m_sprite.Transform.PosY -= 1;
                Game1.player.ShowPlayer();
                isVisible = false;
                m_cloud.IsVisible = false;
                m_sword.IsVisible = false;
            });

            //Shling!
            ScaleToAction shlingScale = new ScaleToAction(Program.TheGame, m_shlingSprite.Transform, new Vector2(ShlingScale, ShlingScale), 1);
            shlingScale.Timer.Interval = ShlingTime;
            shlingScale.StartScale = Vector2.Zero;
            shlingScale.Interpolator = new PSquareInterpolation(2);

            RotateToStaticAction shlingRotate = new RotateToStaticAction(Program.TheGame, m_shlingSprite.Transform, ShlingSpin, 1);
            shlingRotate.Timer.Interval = ShlingTime;
            m_shling = new Concurrent(new PastaGameLibrary.Action[] { shlingScale, shlingRotate });

            Sequence readyAnim = new Sequence(1);
            readyAnim.AddAction(new DelayAction(Program.TheGame, 0.5f));
            readyAnim.AddAction(new MethodAction(delegate() {
                    Cutscenes.GetReady();
                    SoundEffectLibrary.Get("sword_slash").Play();
                }));

            Concurrent shlingReady = new Concurrent(new PastaGameLibrary.Action[] {
                m_shling,
                readyAnim,
            });

            m_ascend = new Sequence(1);
            m_ascend.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime));
            m_ascend.AddAction(new MethodAction(delegate() { m_ascendSound.Play(); }));
            Concurrent ascendAndSword = new Concurrent(new PastaGameLibrary.Action[] { m_ascendMovement, swordAndCloudMovement });
            m_ascend.AddAction(ascendAndSword);
            m_ascend.AddAction(showPlayer);
            m_ascend.AddAction(shlingReady);

            m_physics = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = 3.0f;

            m_jumpFromTotem = new Sequence(1);
            m_decelerate = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1);
            m_decelerate.Interpolator = new PSquareInterpolation(0.5f);
            m_jumpFromTotem.AddAction(m_decelerate);
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.2f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
                {
                    m_physics.OnBounce = null;
                    m_physics.Throw(1.0f, -2.0f, 0);
                    Game1.CurrentMusic.StopDynamicMusic();
                    SoundEffectLibrary.Get("sword_slash").Play();
                }));
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.75f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                Game1.SetupNextRound();
                if (Game1.CurrentTotem == null)
                    Cutscenes.GoToCliff();
                else
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
            }));
            m_actionManager = new SingleActionManager();

            m_hitSpikes = new Sequence(1);

            m_moveToCrashingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), new Transform(), 1);
            m_moveToCrashingPlayer.Timer.Interval = 0.2f;

            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_hitSpikes.AddAction(m_moveToCrashingPlayer);
            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_hitSpikes.AddAction(new MethodAction(delegate() {
                if(Game1.CurrentTotem == null)
                    Cutscenes.GoToCliff();
                else
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                m_sprite.SetFrame(0);
                m_physics.OnBounce = null;
                m_physics.Throw(0, -3, 0);
                m_transform.PosY = m_physics.GroundLevel;
            }));

            m_auraParticles = new ParticleSystem(Program.TheGame, 100);
            m_soulParticles = new ParticleSystem(Program.TheGame, 500);

            m_levitate = new Sequence(1);
            m_moveToCliffTip = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(Cutscenes.InitialCharacterPosition + 10, -8), 1);
            m_moveToCliffTip.Interpolator = new PSmoothstepInterpolation();
            m_moveToCliffTip.Timer.Interval = 1.0f;
            m_levitate.AddAction(m_moveToCliffTip);
            m_levitate.AddAction(new MethodAction(delegate() { m_generateSouls = true; }));

            m_particleGenerator = new ParticleGenerator<GlitterParticle>(Program.TheGame, m_auraParticles);
            m_particleGenerator.Automatic = true;
            m_particleGenerator.GenerationInterval = 0.01f;
            m_soulParticleGenerator = new ParticleGenerator<SoulParticle>(Program.TheGame, m_soulParticles);

            m_jumpInMouth = new Sequence(1);
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { m_generateSouls = false; }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { JumpInMonsterMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.25f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.monster.CloseMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 2.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.crowd.PushNewGuy(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.StartMainMenu(); }));
        }
Exemplo n.º 9
0
        public TotemSection(SectionType type)
            : base()
        {
            m_type = type;
            m_physics = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = Mass;
            m_physics.Restitution = Bounciness;
            m_generator = new ParticleGenerator<Soul>(Program.TheGame, Game1.Souls);

            m_explosion = new ParticleGenerator<Explosion>(Program.TheGame, Game1.Explosions);
        }