Ejemplo n.º 1
0
        void MiniScreen.Draw(SpriteBatch sb)
        {
            if (effect.IsDisposed)
            {
                return;
            }

            DrawBackground(sb);
            DrawHud(sb);

            sb.Begin(samplerState: SamplerState.PointClamp);

            if (enemyDraw)
            {
                enemy.Draw(sb, bgTimer, flashColor, offsetHeightTop, offsetHeightBottom);
            }

            sb.End();
            sb.Begin(samplerState: SamplerState.PointWrap);

            if (!victory || turnWaiter > 0.4)
            {
                text.Draw(sb);
            }

            if (victory && turnWaiter > 0.4)
            {
                sb.Draw(youWon, new Rectangle((Game1.width - 102) / 2, 18, 102, 10), new Rectangle(0, 0, 102, 10), victoryColor);
            }

            if (curPhase == Phase.AnimPhase && !text.visible)
            {
                int frame = magicAnim.getFrame();
                sb.Draw(magic, new Rectangle(0, 0, Game1.width, Game1.height), new Rectangle((frame % 4) * Game1.width, (frame / 4) * Game1.height, Game1.width, Game1.height), magicColor);
            }
            sb.End();
        }
Ejemplo n.º 2
0
        public void Move(GameTime gameTime, bool notRunning = true)        //SAFE TO ASSUME DOESN'T WORK. WASN'T TESTED WITH NPC
        {
            bool hPass = false;

            //Console.WriteLine("HSTATE: " + curStateH);
            //Console.WriteLine("VSTATE: " + curStateV);
            //Console.WriteLine(timer);
            timer += gameTime.ElapsedGameTime.TotalSeconds;
            if (timer > animSpeed)
            {
                if (notRunning)
                {
                    walkDown.advanceFrame();
                }
                timer = 0;
            }
            if (curStateH == HorizontalState.Right)            // && body.LinearVelocity.X > 0)
            {
                if (body.LinearVelocity.X > 0)
                {
                    hPass   = true;
                    flipped = false;
                    //SetStateH(HorizontalState.Right);
                    //curAnim = walkRight;
                    offsetX = 9;
                    //offsetY = 25;
                    //animIndex = (int)State.Left;
                    animIndex = walkDown.getFrame();
                }
            }
            else if (curStateH == HorizontalState.Left)            // && body.LinearVelocity.X < 0)
            {
                if (body.LinearVelocity.X < 0)
                {
                    hPass   = true;
                    flipped = true;
                    //SetStateH(HorizontalState.Left);
                    //curAnim = walkRight;
                    offsetX = 9;
                    //offsetY = 25;
                    //animIndex = (int)State.Left;

                    animIndex = walkDown.getFrame();
                }
            }
            else if (moveTimer == 0)            //Resets direction when movement begins
            {
                offsetX = 0;
            }

            if (curStateV == VerticalState.Up)            // && body.LinearVelocity.Y < 0)
            {
                if (body.LinearVelocity.Y < 0)
                {
                    flipped = false;
                    //SetStateV(VerticalState.Up);
                    //curAnim = walkUp;
                    //offsetX = 0;
                    offsetY = 54;
                    //animIndex = (int)State.Left;

                    animIndex = walkDown.getFrame();
                }
            }
            else if (curStateV == VerticalState.Down)            // && body.LinearVelocity.Y > 0)
            {
                if (body.LinearVelocity.Y > 0)
                {
                    flipped = false;
                    //SetStateV(VerticalState.Down);
                    //curAnim = walkDown;
                    //offsetX = 0;
                    offsetY = 0;
                    //animIndex = (int)State.Left;

                    animIndex = walkDown.getFrame();
                }
            }
            else
            {
                if (moveTimer == 0)               //Resets direction when movement begins
                {
                    offsetY = 27;
                }

                if (!hPass)
                {
                    SetStandingAnim();
                }
            }
        }