Esempio n. 1
0
 protected override void Initialize()
 {
     player = new Player();
     GR     = new Death();
     zombie = new Zombie();
     mic    = new Mictlantecuhtli();
     health = new HUD();
     //   cierra = new Cierra();
     base.Initialize();
 }
Esempio n. 2
0
        public void Update(Death death, Player ritcher)
        {
            if (death.reaperRect.Intersects(ritcher.hitRect))
            {
                if (rectangleHPR.Height >= 0)
                {
                    rectangleHPR.Height -= 25;
                    ritcher.gethit       = true;
                }

                else if (rectangleHPR.Height <= 0)
                {
                    ritcher.die = true;
                }
            }
        }
Esempio n. 3
0
        // ++++++++++++++++++++++++++++    ACCIONES A REALIZAR    ++++++++++++++++++++++++++++++++++++++++  //
        public void acciones(GameTime gametime, Death death)
        {
            //      ***SELECCION ACCIONES***      //

            #region "Entorno"

            // AL NO ESTAR EN EL PISO


            /*if (posicion.Y >= GraphicsDeviceManager.DefaultBackBufferHeight - 50)
             * {
             *  velocity.Y = 0f;
             *
             *  caminando = true;
             *  siguiendo = true;
             * }*/

            // CUANDO YA ESTÁS SOBRE EL PISO "Y" NO SE MUEVE



            #endregion

            #region "Salto Normal"

            if (salto == true)
            {
                float i = 2f;
                velocity.Y += velValor * i;
            }

            if (salto == false)
            {
                velocity.Y = 0f;
            }

            #endregion

            #region "Backflip"

            if (backflip == true)
            {
                crouch = false;

                timeCounter += 0.25F;

                posicion.Y -= 8f;
                velocity.Y  = -0.001f;
                velocity.X  = -0.10f;

                animacionPlayer.PlayAnimation(bflip);
                salto = true;

                if (flipeado == false)
                {
                    posicion.X -= 22f;
                }

                else if (flipeado == true)
                {
                    posicion.X += 22f;
                }

                if (timeCounter >= 1.55)
                {
                    backflip    = false;
                    timeCounter = 0;
                }
            }

            #endregion

            #region "Flip"

            if (flip == true)
            {
                animacionPlayer.PlayAnimation(saltar);
                flip = false;
            }

            #endregion

            #region "Agacharse"

            if (crouch == true)
            {
                timeCounter += 0.25F;
                velocity.X   = 0f;

                animacionPlayer.PlayAnimation(agachar);

                if (timeCounter >= 7)
                {
                    crouch      = false;
                    timeCounter = 0;
                }
            }

            #endregion

            #region "Muerte"

            if (die == true)
            {
                animacionPlayer.PlayAnimation(dies);
            }

            #endregion

            #region "Ataque"

            if (atack == true)
            {
                timeCounter += 0.25F;
                //velocity.X = 0f;

                velocity.Y = -0.001f;
                velocity.X = 0f;

                animacionPlayer.PlayAnimation(atacar);

                if (timeCounter >= 11)
                {
                    atack       = false;
                    timeCounter = 0;
                }
            }

            #endregion

            #region "Ser Atacado"

            if (gethit == true)
            {
                atack = false;
                //backflip = false;

                timeCounter += 0.25F;

                posicion.Y -= 21f;
                velocity.Y  = -0.85f;

                animacionPlayer.PlayAnimation(hurts);
                salto = true;

                if (flipeado == false)
                {
                    posicion.X -= 27f;
                }

                else if (flipeado == true)
                {
                    posicion.X += 27f;
                }

                if (timeCounter >= 1)
                {
                    gethit      = false;
                    timeCounter = 0;
                }
            }

            #endregion

            #region "Lanzar Oz"

            if (LanzarOz == true)
            {
                siguiendo = false;

                timeCounter += 0.25F;
                velocity.Y   = -0.001f;
                velocity.X   = 0f;
                score       += 1;

                PosOzY -= 1;
                PosOzX -= 1;

                if (timeCounter >= 23)
                {
                    LanzarOz    = false;
                    caminando   = true;
                    siguiendo   = true;
                    timeCounter = 0;
                }
            }
            else
            {
                PosOzX = posicion.X;
                PosOzY = posicion.Y;
            }

            #endregion


            /*
             * //      LANZAR ITEM
             * if (shoot == true)
             * {
             *  animacionPlayer.PlayAnimation(iThrow);
             *  shoot = false;
             * }
             *
             * //      ATAQUE BAJO
             * if (cattack == true)
             * {
             *  animacionPlayer.PlayAnimation(crouchAtk);
             *  cattack = false;
             * } */

            #region "Buscar Posición del Jugador(Ritcher)"


            if (die == false)
            {
                if (LanzarOz == false)
                {
                    if (atack == false)
                    {
                        siguiendo = true; caminando = true;
                    }
                }


                //flip para saber tu orientacion
                if (posicion.X < death.posicion.X)
                {
                    right    = true;
                    flipeado = false;
                    //  velocity.X = 1.5f;
                }

                else if (posicion.X > death.posicion.X)
                {
                    right    = false;
                    flipeado = true;
                    //  velocity.X = -1.5f;
                }
            }


            #endregion

            // ** ACCIÓN DE CAMINAR ** //
            if (caminando == true)
            {
                animacionPlayer.PlayAnimation(caminar);
                caminando = false;
            }

            // *** SEGUIR AL ENEMIGO (JUGADOR RITCHER) *** //
            if (siguiendo == true)
            {
                /* if (playerDistanceX >= -900 && playerDistanceX <= 900 && playerDistanceY >= -900 && playerDistanceY <= 900)
                 * {
                 *   if (playerDistanceX < 10 && playerDistanceY < 10)
                 *   {
                 *
                 *
                 *       velocity.X = -1f;
                 *        velocity.Y = -1f;
                 *   }
                 *   else if (playerDistanceX < 10 && playerDistanceY > 10)
                 *   {
                 *       velocity.X = -1f;
                 *       velocity.Y = 1f;
                 *   }
                 *   else if (playerDistanceX > 10 && playerDistanceY > 10)
                 *   {
                 *       velocity.X = 1f;
                 *       velocity.Y = 1f;
                 *   }
                 *   else if (playerDistanceX > 10 && playerDistanceY < 10)
                 *   {
                 *       velocity.X = 1f;
                 *       velocity.Y = -1f;
                 *   }
                 *
                 *   //atacar cuando estés cerca del enemigo
                 *   else if (playerDistanceX < 0.2f)
                 *   {
                 *       atack = true;
                 *   }
                 *
                 * }
                 * siguiendo = false;
                 *
                 * }
                 * else if(siguiendo == false) { velocity.X = 0f; }*/
            }
        }
Esempio n. 4
0
        public void Update(GameTime gameTime, Death death)
        {
            switch (vertice)
            {
            //      LA MUERTE SE MUEVE AL VERTICE 2
            case 1:
                if (posicion.X < vertice2.GetX() - 1 && posicion.X > vertice1.GetX() - 1)
                {
                    puntoPosicion = elipse.movePunto(posicion.X + 1);
                }
                else
                {
                    vertice = 2;
                    calularMetricas((int)posicion.X);
                }
                break;

            //      LA MUERTE SE MUEVE AL VERTICE 1
            case 2:

                if (posicion.X < vertice2.GetX() && posicion.X > vertice1.GetX())
                {
                    puntoPosicion = elipse.movePunto(posicion.X - 1);
                }
                else
                {
                    vertice = 1;
                    calularMetricas((int)posicion.X);
                }
                break;

            default:
                break;
            }

            /* if ((posicion.X < vertice2.GetX() && posicion.X >= vertice1.GetX()) && movimientoCompleto==false)
             *   puntoPosicion = elipse.movePunto(posicion.X + 1);
             *
             * else
             * {
             *   movimientoCompleto = true;
             *  if (posicion.X >= vertice2.GetX()-1)
             *  {
             *      puntoPosicion = elipse.movePunto(posicion.X - 1);
             *  }
             *  else if (posicion.X <= vertice1.GetX() + 1)
             *      puntoPosicion = elipse.movePunto(posicion.X + 1);
             *  else
             *  {
             *      movimientoCompleto = false;
             *      calularMetricas((int)posicion.X);
             *  }
             * }
             */
            //animacionPlayer.PlayAnimation(caminar);
            posicion.X = puntoPosicion.GetX();
            posicion.Y = puntoPosicion.GetY();

            // DISTANCIA ENTRE ENEMIGO(RITCHER) Y LOBITO
            playerDistanceX = death.posicion.X - posicion.X;
            playerDistanceY = death.posicion.Y - posicion.Y;

            #region "Movimientos Aleatorios"

            timeCountRandom += 0.25F;

            if (die == false)
            {
                if (timeCountRandom >= 50)
                {
                    aleat = r.NextDouble();

                    if (aleat < 0.50)
                    {
                        LanzarOz = true;
                    }
                    else if (aleat > 0.50)
                    {
                        LanzarOz = true;
                    }


                    timeCountRandom = 0;
                }
            }

            #endregion

            //
            siguiendo = false;
            piso      = false;
            caminando = false;
            levitando = false;

            standRect = new Rectangle((int)posicion.X, (int)posicion.Y, standRect.Width, standRect.Height);
            hitRect   = new Rectangle((int)posicion.X, (int)posicion.Y, hitRect.Width, hitRect.Height);


            //      POSICIONES DE LOS RECTANGULOS DE COLISION
            getHitted.X = posicion.X - 10;
            getHitted.Y = posicion.Y - 85;
            getStand.X  = posicion.X - 23;
            getStand.Y  = posicion.Y - 18;


            acciones(gameTime, death);
        }