Exemplo n.º 1
0
        public void calCentro(Punto punto1, Punto punto2)
        {
            Punto centro = new Punto();

            centro.SetX((punto1.GetX() + punto2.GetX()) / 2);
            centro.SetY((punto1.GetY() + punto2.GetY()) / 2);
            setCentro(centro);
        }
Exemplo n.º 2
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);
        }