示例#1
0
    //Load each of the characters.
    public GS.State Update(int ms)
    {
        if (GS.Inputs[0].PressedRight)
        {
            CharacterSelect = (CharacterSelect + 1) % 4;
        }

        if (GS.Inputs[0].PressedLeft)
        {
            CharacterSelect = CharacterSelect == 0 ? 3 : CharacterSelect - 1;
        }

        if (GS.Inputs[0].PressedRight || GS.Inputs[0].PressedLeft)
        {
            Pirate.Hold("idle", 0, 2);
            Ninja.Hold("idle", 0, 2);
            Meximage.Hold("idle", 0, 2);
            Dragon.Hold("idle", 0, 2);

            if (CharacterSelect == 0)
            {
                Pirate.Hold("swing", 0, 2);
            }
            if (CharacterSelect == 1)
            {
                Dragon.Hold("swing", 0, 2);
            }
            if (CharacterSelect == 2)
            {
                Meximage.Hold("swing", 0, 2);
            }
            if (CharacterSelect == 3)
            {
                Ninja.Hold("swing", 0, 2);
            }
        }

        return(GS.Inputs[0].PressedFire ? GS.State.InGame : GS.State.CharSelect);
    }
示例#2
0
    private void AnimateMove(Input i)
    {
        if (i.Left || i.Right || i.Up || i.Down)
        {
            if (Anim.CurrentAnimationName.Equals("idle") || Anim.YFrame != (int)Direction)
            {
                Anim.AutoAnimate("walk", (int)Direction);
            }
        }

        else
        {
            Anim.Hold("idle", 0, (int)Direction);
        }


        //check to see if my dx would cause a collision.
        if (DX < 0 && !CanMove(3))
        {
            DX = 0;
        }
        if (DX >= DeltaScale && !CanMove(1))
        {
            DX = DeltaScale - 1;
        }
        if (DY < 0 && !CanMove(0))
        {
            DY = 0;
        }
        if (DY >= DeltaScale && !CanMove(2))
        {
            DY = DeltaScale - 1;
        }

        while (DX >= DeltaScale)
        {
            DX = DX - DeltaScale; X++;
        }                                                       //3 , 1100 -> 4, 100
        while (DY >= DeltaScale)
        {
            DY = DY - DeltaScale; Y++;
        }
        while (DX < 0)
        {
            DX = DX + DeltaScale; X--;
        }                                             //3, -100 -> 2, 900
        while (DY < 0)
        {
            DY = DY + DeltaScale; Y--;
        }
    }
示例#3
0
    public CharSelect()
    {
        Pirate   = new AnimationSet(@"creatures\pc\pirate\anim.xml");
        Ninja    = new AnimationSet(@"creatures\pc\ninja\anim.xml");
        Meximage = new AnimationSet(@"creatures\pc\meximage\anim.xml");
        Dragon   = new AnimationSet(@"creatures\pc\dragon\anim.xml");

        Pirate.Hold("swing", 0, 2);
        Ninja.Hold("idle", 0, 2);
        Meximage.Hold("idle", 0, 2);
        Dragon.Hold("idle", 0, 2);

        Arrow = Utils.TextureLoader(@"misc\bigDownArrow.png");
        SoundManager.Play("originlong.ogg");
    }