Ejemplo n.º 1
0
 public void DownAction()
 {
     VerticalState.DownAction(this);
     if (HorizontalState is RunningLeftAvatar || HorizontalState is RunningRightAvatar)
     {
         VerticalState = new IdleAvatar();
     }
 }
Ejemplo n.º 2
0
 public void RightAction()
 {
     HorizontalState.RightAction(this);
     if (VerticalState is CrouchingAvatar)
     {
         VerticalState = new IdleAvatar();
     }
 }
Ejemplo n.º 3
0
        public void UpAction()
        {
            if (VerticalState is CrouchingAvatar)
            {
                VerticalState = new IdleAvatar();
            }
            else if (!(VerticalState is JumpingAvatar || VerticalState is FallingAvatar))
            {
                VerticalState.UpAction(this);
                if (PowerState is SuperState || PowerState is FireState)
                {
                    Game1.SoundMap["SuperJump"].Play();
                }
                else
                {
                    Game1.SoundMap["NormalJump"].Play();
                }

                _velocity.Y = -3.2f;
            }
        }
Ejemplo n.º 4
0
        public override void CollideBottom(CollidableObject obj)
        {
            if (obj is PowerUp)
            {
                CollidePowerUp(obj as PowerUp);
            }
            else if (obj is Goomba || obj is Koopa)
            {
                Game1.SoundMap["Stomp"].Play();
                _velocity.Y = -1;
            }
            else if (obj is Peach)
            {
                TimeWon      = new TimeSpan();
                OnFlagpole   = true;
                Velocity     = new Vector2(0, -1);
                Acceleration = new Vector2(0, 0);
                UpAction();
            }
            else if (obj is Cloud)
            {
                if (VerticalState is IdleAvatar)
                {
                    if ((HorizontalState is LeftAvatar || HorizontalState is RightAvatar))
                    {
                        _velocity.X = obj.Velocity.X;
                    }
                    _velocity.Y = obj.Velocity.Y;
                }
                else
                {
                    _velocity.Y = 0;
                }

                if (!(VerticalState is CrouchingAvatar))
                {
                    VerticalState = new IdleAvatar();
                }
            }
            else if (obj is Block)
            {
                _velocity.Y = 0;
                if (!(VerticalState is CrouchingAvatar))
                {
                    VerticalState = new IdleAvatar();
                }
            }
            else if (obj is WarpPipe)
            {
                _velocity.Y = 0;
                bool canFit = CollisionBox.Min.X >= (obj as WarpPipe).CollisionBox.Min.X && CollisionBox.Max.X <= (obj as WarpPipe).CollisionBox.Max.X;
                if (VerticalState is CrouchingAvatar && (obj as WarpPipe).Type is End && canFit)
                {
                    InitWarpDown(obj as WarpPipe);
                }
                else
                {
                    VerticalState = new IdleAvatar();
                }
            }

            if ((obj is MiniCovid || obj is CovidBoss) && !Sprite.IsMasked)
            {
                TakeToxicDamage(18);
                _velocity.Y = -1.75f; // bounce higher here than for goomba
            }
            else if (obj is MiniCovid || obj is CovidBoss)
            {
                _velocity.Y = -1.75f;
            }
        }