Exemple #1
0
 private void Update()
 {
     if (Time.time > 5.0f && !attacking)
     {
         ActionState = Action_State.ATTACKING;
         attacking   = true;
     }
 }
Exemple #2
0
        private void Proto_Movement(GameTime gameTime, Tools.KeyPress keyPress)
        {
            switch (actionState)
            {
                case Action_State.stand:
                    if (sprite.Animation == RStand) { facingDirection = Facing_Direction.right; }
                    if (sprite.Animation == LStand) { facingDirection = Facing_Direction.left; }

                    if (sprite.Animation == RStand || sprite.Animation == LStand)
                    {
                        if (sprite.FrameIndex == 1)
                        {
                            if (keyPress.key_Right >= 1 && keyPress.key_Left >= 1)
                            {
                                sprite.PlayAnimation(AniSwitch(RStand, LStand));
                            }
                            else if (keyPress.key_Z >= 1)
                            {
                                sprite.PlayAnimation(AniSwitch(RStand_RStance, LStand_LStance));
                            }
                            else if (keyPress.key_Right >= 1)
                            {
                                if (facingDirection == Facing_Direction.left) { sprite.PlayAnimation(LStand_RStand); }
                                else
                                {
                                    sprite.PlayAnimation(AniSwitchStep(RStand_RRStep, RStand_RLStep));
                                }
                            }
                            else if (keyPress.key_Left >= 1)
                            {
                                if (facingDirection == Facing_Direction.right) { sprite.PlayAnimation(RStand_LStand); }
                                else
                                {
                                    sprite.PlayAnimation(AniSwitchStep(LStand_LRStep, LStand_LLStep));
                                }
                            }
                        }
                    }
                    else if (sprite.Animation == RStand_LStand || sprite.Animation == LStand_RStand)
                    {
                        if (sprite.FrameIndex == 2)
                        {
                            sprite.PlayAnimation(AniSwitch(LStand, RStand));
                        }
                    }
                    else if (sprite.Animation == RStand_RStance || sprite.Animation == LStand_LStance)
                    {
                        if (sprite.FrameIndex == 1)
                        {
                            sprite.PlayAnimation(AniSwitch(RStance, LStance));
                            actionState = Action_State.stance;
                        }
                    }
                    else if (sprite.Animation == RStand_RRStep || sprite.Animation == RStand_RLStep ||
                        sprite.Animation == LStand_LRStep || sprite.Animation == LStand_LLStep)
                    {
                        if (sprite.FrameIndex == 1)
                        {
                            if (keyPress.key_Right >= 1 && facingDirection == Facing_Direction.right)
                            {
                                if (sprite.Animation == RStand_RRStep || sprite.Animation == RStand_RLStep)
                                {
                                    sprite.PlayAnimation(AniSwitchStep(RRStep_RLStep, RLStep_RRStep));
                                    actionState = Action_State.walk;
                                }
                            }
                            else if (keyPress.key_Left >= 1 && facingDirection == Facing_Direction.left)
                            {
                                if (sprite.Animation == LStand_LRStep || sprite.Animation == LStand_LLStep)
                                {
                                    sprite.PlayAnimation(AniSwitchStep(LRStep_LLStep, LLStep_LRStep));
                                    actionState = Action_State.walk;
                                }
                            }
                            else
                            {
                                sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRStep_RStand, RLStep_RStand), AniSwitchStep(LRStep_LStand, LLStep_LStand)));
                            }
                        }
                    }
                    else if (sprite.Animation == RRStep_RStand || sprite.Animation == RLStep_RStand ||
                         sprite.Animation == LRStep_LStand || sprite.Animation == LLStep_LStand)
                    {
                        if (sprite.FrameIndex == 2)
                        {
                            if (sprite.Animation == RRStep_RStand || sprite.Animation == LRStep_LStand)
                            {
                                nextStep = Next_Step.left;
                                sprite.PlayAnimation(AniSwitch(RStand, LStand));
                            }
                            else if (sprite.Animation == RLStep_RStand || sprite.Animation == LLStep_LStand)
                            {
                                nextStep = Next_Step.right;
                                sprite.PlayAnimation(AniSwitch(RStand, LStand));
                            }
                        }
                    }
                    else
                    {
                        sprite.PlayAnimation(AniSwitch(RStand, LStand));
                    }
                    break;
                case Action_State.walk:
                    if (sprite.Animation == RRStep_RLStep || sprite.Animation == RLStep_RRStep ||
                        sprite.Animation == LRStep_LLStep || sprite.Animation == LLStep_LRStep)
                    {
                        if (sprite.FrameIndex == 3)
                        {
                            if (keyPress.key_Right >= 1)
                            {
                                if (sprite.Animation == RRStep_RLStep)
                                {
                                    if (keyPress.key_Z >= 1)
                                    {
                                        sprite.PlayAnimation(RLStep_RRRun);
                                        nextStep = Next_Step.right;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(RLStep_RRStep);
                                        nextStep = Next_Step.right;
                                    }
                                }
                                else if (sprite.Animation == RLStep_RRStep)
                                {
                                    if (keyPress.key_Z >= 1)
                                    {
                                        sprite.PlayAnimation(RRStep_RLRun);
                                        nextStep = Next_Step.left;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(RRStep_RLStep);
                                        nextStep = Next_Step.left;
                                    }
                                }
                                else
                                {
                                    sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRStep_RStand, RLStep_RStand), AniSwitchStep(LRStep_LStand, LLStep_LStand)));
                                }
                            }
                            else if (keyPress.key_Left >= 1)
                            {
                                if (sprite.Animation == LRStep_LLStep)
                                {
                                    if (keyPress.key_Z >= 1)
                                    {
                                        sprite.PlayAnimation(LLStep_LRRun);
                                        nextStep = Next_Step.right;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(LLStep_LRStep);
                                        nextStep = Next_Step.right;
                                    }
                                }
                                else if (sprite.Animation == LLStep_LRStep)
                                {
                                    if (keyPress.key_Z >= 1)
                                    {
                                        sprite.PlayAnimation(LRStep_LLRun);
                                        nextStep = Next_Step.left;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(LRStep_LLStep);
                                        nextStep = Next_Step.left;
                                    }
                                }
                                else
                                {
                                    sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRStep_RStand, RLStep_RStand), AniSwitchStep(LRStep_LStand, LLStep_LStand)));
                                }
                            }
                            else
                            {
                                sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRStep_RStand, RLStep_RStand), AniSwitchStep(LRStep_LStand, LLStep_LStand)));
                            }
                        }
                    }
                    else if (sprite.Animation == RRStep_RLRun || sprite.Animation == RLStep_RRRun ||
                        sprite.Animation == LRStep_LLRun || sprite.Animation == LLStep_LRRun)
                    {
                        if (sprite.FrameIndex == 3)
                        {
                            sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRRun_RLRun, RLRun_RRRun), AniSwitchStep(LRRun_LLRun, LLRun_LRRun)));
                            actionState = Action_State.run;
                        }
                    }
                    else if (sprite.Animation == RRStep_RStand || sprite.Animation == RLStep_RStand ||
                        sprite.Animation == LRStep_LStand || sprite.Animation == LLStep_LStand)
                    {
                        if (sprite.FrameIndex == 2)
                        {
                            if (sprite.Animation == RRStep_RStand || sprite.Animation == LRStep_LStand)
                            {
                                nextStep = Next_Step.left;
                                sprite.PlayAnimation(AniSwitch(RStand, LStand));
                                actionState = Action_State.stand;
                            }
                            else if (sprite.Animation == RLStep_RStand || sprite.Animation == LLStep_LStand)
                            {
                                nextStep = Next_Step.right;
                                sprite.PlayAnimation(AniSwitch(RStand, LStand));
                                actionState = Action_State.stand;
                            }
                        }
                    }
                    else
                    {
                        if (sprite.FrameIndex == 3)
                        {
                            sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRStep_RStand, RLStep_RStand), AniSwitchStep(LRStep_LStand, LLStep_LStand)));
                        }
                    }
                    break;
                case Action_State.stance:
                    if (sprite.Animation == RStance) { facingDirection = Facing_Direction.right; }
                    if (sprite.Animation == LStance) { facingDirection = Facing_Direction.left; }

                    if (sprite.Animation == RStance || sprite.Animation == LStance)
                    {
                        if (sprite.FrameIndex == 1)
                        {
                            if (keyPress.key_Z >= 1)
                            {
                                if (facingDirection == Facing_Direction.right)
                                {
                                    if (keyPress.key_Left >= 1)
                                    {
                                        sprite.PlayAnimation(RStance_LStance);
                                    }
                                    else if (keyPress.key_Right >= 1)
                                    {
                                        sprite.PlayAnimation(AniSwitchStep(RStance_RRRun, RStance_RLRun));
                                    }
                                }
                                else if (facingDirection == Facing_Direction.left)
                                {
                                    if (keyPress.key_Right >= 1)
                                    {
                                        sprite.PlayAnimation(LStance_RStance);
                                    }
                                    else if (keyPress.key_Left >= 1)
                                    {
                                        sprite.PlayAnimation(AniSwitchStep(LStance_LRRun, LStance_LLRun));
                                    }
                                }
                            }
                            else
                            {
                                sprite.PlayAnimation(AniSwitch(RStance_RStand, LStance_LStand));
                            }
                        }
                    }
                    else if (sprite.Animation == RStance_RRRun || sprite.Animation == RStance_RLRun ||
                        sprite.Animation == LStance_LRRun || sprite.Animation == LStance_LLRun)
                    {
                        if (sprite.FrameIndex == 2)
                        {
                            if (facingDirection == Facing_Direction.right)
                            {
                                if (keyPress.key_Left >= 1)
                                {
                                    sprite.PlayAnimation(AniSwitchStep(RRRun_RStance, RLRun_RStance));
                                }
                                else if (keyPress.key_Right >= 1)
                                {
                                    sprite.PlayAnimation(AniSwitchStep(RRRun_RLRun, RLRun_RRRun));
                                    actionState = Action_State.run;
                                }
                                else
                                {
                                    sprite.PlayAnimation(AniSwitchStep(RRRun_RStance, RLRun_RStance));
                                }
                            }
                            else if (facingDirection == Facing_Direction.left)
                            {
                                if (keyPress.key_Right >= 1)
                                {
                                    sprite.PlayAnimation(AniSwitchStep(LRRun_LStance, LLRun_LStance));
                                }
                                else if (keyPress.key_Left >= 1)
                                {
                                    sprite.PlayAnimation(AniSwitchStep(LRRun_LLRun, LLRun_LRRun));
                                    actionState = Action_State.run;
                                }
                                else
                                {
                                    sprite.PlayAnimation(AniSwitchStep(LRRun_LStance, LLRun_LStance));
                                }
                            }
                        }
                    }
                    else if (sprite.Animation == RStance_RStand || sprite.Animation == LStance_LStand)
                    {
                        if (sprite.FrameIndex == 1)
                        {
                            sprite.PlayAnimation(AniSwitch(RStand, LStand));
                            actionState = Action_State.stand;
                        }
                    }
                    else if (sprite.Animation == RRRun_RStance || sprite.Animation == RLRun_RStance ||
                        sprite.Animation == LRRun_LStance || sprite.Animation == LLRun_LStance)
                    {
                        if (sprite.FrameIndex == 2)
                        {
                            if (sprite.Animation == RRRun_RStance)
                            {
                                sprite.PlayAnimation(RStance);
                                nextStep = Next_Step.left;
                            }
                            else if (sprite.Animation == RLRun_RStance)
                            {
                                sprite.PlayAnimation(RStance);
                                nextStep = Next_Step.right;
                            }
                            else if (sprite.Animation == LRRun_LStance)
                            {
                                sprite.PlayAnimation(LStance);
                                nextStep = Next_Step.left;
                            }
                            else if (sprite.Animation == LLRun_LStance)
                            {
                                sprite.PlayAnimation(LStance);
                                nextStep = Next_Step.right;
                            }
                        }
                    }
                    else if (sprite.Animation == RStance_LStance || sprite.Animation == LStance_RStance)
                    {
                        if (sprite.FrameIndex == 2)
                        {
                            sprite.PlayAnimation(AniSwitch(LStance, RStance));
                        }
                    }
                    else
                    {
                        sprite.PlayAnimation(AniSwitch(RStance_RStand, LStance_LStand));
                    }
                    break;
                case Action_State.run:
                    if (sprite.Animation == RRRun_RLRun || sprite.Animation == RLRun_RRRun ||
                        sprite.Animation == LRRun_LLRun || sprite.Animation == LLRun_LRRun)
                    {
                        if (sprite.FrameIndex == 3)
                        {
                            if (keyPress.key_Right >= 1)
                            {
                                if (keyPress.key_Z >= 1)
                                {
                                    if (sprite.Animation == RRRun_RLRun)
                                    {
                                        sprite.PlayAnimation(RLRun_RRRun);
                                        nextStep = Next_Step.right;
                                    }
                                    else if (sprite.Animation == RLRun_RRRun)
                                    {
                                        sprite.PlayAnimation(RRRun_RLRun);
                                        nextStep = Next_Step.left;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRRun_RStance, RLRun_RStance), AniSwitchStep(LRRun_LStance, LLRun_LStance)));
                                    }
                                }
                                else
                                {
                                    if (sprite.Animation == RRRun_RLRun)
                                    {
                                        sprite.PlayAnimation(RLRun_RRStep);
                                        nextStep = Next_Step.right;
                                    }
                                    else if (sprite.Animation == RLRun_RRRun)
                                    {
                                        sprite.PlayAnimation(RRRun_RLStep);
                                        nextStep = Next_Step.left;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRRun_RStance, RLRun_RStance), AniSwitchStep(LRRun_LStance, LLRun_LStance)));
                                    }
                                }

                            }
                            else if (keyPress.key_Left >= 1)
                            {
                                if (keyPress.key_Z >= 1)
                                {
                                    if (sprite.Animation == LRRun_LLRun)
                                    {
                                        sprite.PlayAnimation(LLRun_LRRun);
                                        nextStep = Next_Step.right;
                                    }
                                    else if (sprite.Animation == LLRun_LRRun)
                                    {
                                        sprite.PlayAnimation(LRRun_LLRun);
                                        nextStep = Next_Step.left;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRRun_RStance, RLRun_RStance), AniSwitchStep(LRRun_LStance, LLRun_LStance)));
                                    }
                                }
                                else
                                {
                                    if (sprite.Animation == LRRun_LLRun)
                                    {
                                        sprite.PlayAnimation(LLRun_LRStep);
                                        nextStep = Next_Step.right;
                                    }
                                    else if (sprite.Animation == LLRun_LRRun)
                                    {
                                        sprite.PlayAnimation(LRRun_LLStep);
                                        nextStep = Next_Step.left;
                                    }
                                    else
                                    {
                                        sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRRun_RStance, RLRun_RStance), AniSwitchStep(LRRun_LStance, LLRun_LStance)));
                                    }
                                }
                            }
                            else
                            {
                                sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRRun_RStance, RLRun_RStance), AniSwitchStep(LRRun_LStance, LLRun_LStance)));
                            }
                        }
                    }
                    else if (sprite.Animation == RRRun_RStance || sprite.Animation == RLRun_RStance ||
                        sprite.Animation == LRRun_LStance || sprite.Animation == LLRun_LStance)
                    {
                        if (sprite.FrameIndex == 2)
                        {
                            if (sprite.Animation == RRRun_RStance || sprite.Animation == LRRun_LStance)
                            {
                                nextStep = Next_Step.left;
                                sprite.PlayAnimation(AniSwitch(RStance, LStance));
                                actionState = Action_State.stance;
                            }
                            else if (sprite.Animation == RLRun_RStance || sprite.Animation == LLRun_LStance)
                            {
                                nextStep = Next_Step.right;
                                sprite.PlayAnimation(AniSwitch(RStance, LStance));
                                actionState = Action_State.stance;
                            }
                        }
                    }
                    else if (sprite.Animation == RRRun_RLStep || sprite.Animation == RLRun_RRStep ||
                        sprite.Animation == LRRun_LLStep || sprite.Animation == LLRun_LRStep)
                    {
                        if (sprite.FrameIndex == 3)
                        {
                            sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRStep_RLStep, RLStep_RRStep), AniSwitchStep(LRStep_LLStep, LLStep_LRStep)));
                            actionState = Action_State.walk;
                        }
                    }
                    else
                    {
                        if (sprite.FrameIndex == 3)
                        {
                            sprite.PlayAnimation(AniSwitch(AniSwitchStep(RRRun_RStance, RLRun_RStance), AniSwitchStep(LRRun_LStance, LLRun_LStance)));
                        }
                    }

                    break;
            }
        }
Exemple #3
0
        public Player(Game game, GraphicsDeviceManager graphics)
            : base(game)
        {
            this.game = game;
            position = new Vector2(400, 410);
            actionState = Action_State.stand;
            facingDirection = Facing_Direction.right;
            nextStep = Next_Step.right;
            scarfPosition = position - new Vector2(0, -180);

            scarf = new Scarf(game, position);
            setCanMove(true,true);
        }