Example #1
0
        public void Update(GameTime gameTime)
        {
            if (CurrentAnimation != null)
            {
                switch (State)
                {
                case 0:     //Idle
                    //Cursor = MoveCursor;
                    CurrentAnimation = Animations[0];
                    break;

                case 1:     //Move
                    //Cursor = MoveCursor;
                    if (RightPress == true)
                    {
                        //P1 Move right
                        CurrentAnimation          = Animations[1];
                        CurrentAnimation.IsFliped = false;
                        X += 3;
                    }
                    else if (LeftPress == true)
                    {
                        //P1 Move left
                        CurrentAnimation          = Animations[1];
                        CurrentAnimation.IsFliped = true;
                        X -= 3;
                    }
                    else if (UpPress == true)
                    {
                        //P1 Move up
                        CurrentAnimation          = Animations[2];
                        CurrentAnimation.IsFliped = false;
                        Y -= 3;
                    }
                    else if (DownPress == true)
                    {
                        //P1 Move down
                        CurrentAnimation          = Animations[3];
                        CurrentAnimation.IsFliped = false;
                        Y += 3;
                    }

                    break;

                case 2:     //Shoot
                    //Cursor = Player.Cursor;
                    CurrentAnimation = Animations[5];


                    break;
                }



                Position.Update(X, Y);
                Bounds = new Rectangle(X, Y, CurrentAnimation.FrameWidth, CurrentAnimation.FrameHeight);
                CurrentAnimation.Update(gameTime);

                FieldView.SetPoints((int)Position.X + CurrentAnimation.FrameWidth, (int)Position.Y);
            }


            if (Action)
            {
                Effect.Update(gameTime);
            }
        }